Skip to content
Open
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
16 changes: 13 additions & 3 deletions src/tcp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,26 @@ class BridgeTCPClient : public Client {
}

MsgPack::arr_t<uint8_t> message;
RpcCall async_rpc = bridge->call(TCP_READ_METHOD, connection_id, size, read_timeout);
const bool ret = async_rpc.result(message);
bool ret;
int err;

if (read_timeout > 0) {
RpcCall async_rpc_timeout = bridge->call(TCP_READ_METHOD, connection_id, size, read_timeout);
ret = async_rpc_timeout.result(message);
err = async_rpc_timeout.getErrorCode();
} else {
RpcCall async_rpc = bridge->call(TCP_READ_METHOD, connection_id, size);
ret = async_rpc.result(message);
err = async_rpc.getErrorCode();
}

if (ret) {
for (size_t i = 0; i < message.size(); ++i) {
temp_buffer.store_char(static_cast<char>(message[i]));
}
}

if (async_rpc.getErrorCode() > NO_ERR) {
if (err > NO_ERR) {
_connected = false;
}

Expand Down