Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ class BridgeMonitor: public Stream {

k_mutex_lock(&monitor_mutex, K_FOREVER);

if (!_connected) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware, mutex remains locked here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg thanks!


MsgPack::arr_t<uint8_t> message;
RpcResult async_rpc = bridge->call(MON_READ_METHOD, size);
const bool ret = _connected && async_rpc.result(message);
const bool ret = async_rpc.result(message);

if (ret) {
for (size_t i = 0; i < message.size(); ++i) {
Expand Down
6 changes: 5 additions & 1 deletion src/tcp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class BridgeTCPClient : public Client {
}

size_t written;
k_mutex_lock(&client_mutex, K_FOREVER);
const bool ok = bridge->call(TCP_WRITE_METHOD, connection_id, payload).result(written);
k_mutex_unlock(&client_mutex);
return ok? written : 0;
}

Expand Down Expand Up @@ -185,9 +187,11 @@ class BridgeTCPClient : public Client {

k_mutex_lock(&client_mutex, K_FOREVER);

if (!_connected) return;

MsgPack::arr_t<uint8_t> message;
RpcResult async_rpc = bridge->call(TCP_READ_METHOD, connection_id, size);
const bool ret = _connected && async_rpc.result(message);
const bool ret = async_rpc.result(message);

if (ret) {
for (size_t i = 0; i < message.size(); ++i) {
Expand Down