aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/deps
diff options
context:
space:
mode:
authorMark Meserve <mark.meserve@ni.com>2019-10-07 18:53:59 -0500
committerMartin Braun <martin.braun@ettus.com>2019-10-15 08:13:45 -0700
commit931595b012344df4500c36e4387761b40bf3b3da (patch)
treecf0ec1490c07b90d1f2c1ded5b3db4e3706cae60 /host/lib/deps
parent549a85482dcf50f0f82dfcda585ce91044b7a0ed (diff)
downloaduhd-931595b012344df4500c36e4387761b40bf3b3da.tar.gz
uhd-931595b012344df4500c36e4387761b40bf3b3da.tar.bz2
uhd-931595b012344df4500c36e4387761b40bf3b3da.zip
rpclib: fix hang on connection error during construction
Diffstat (limited to 'host/lib/deps')
-rw-r--r--host/lib/deps/rpclib/lib/rpc/client.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/host/lib/deps/rpclib/lib/rpc/client.cc b/host/lib/deps/rpclib/lib/rpc/client.cc
index 219bc3480..1b366e491 100644
--- a/host/lib/deps/rpclib/lib/rpc/client.cc
+++ b/host/lib/deps/rpclib/lib/rpc/client.cc
@@ -46,8 +46,8 @@ struct client::impl {
boost::asio::async_connect(
writer_->socket_, endpoint_iterator,
[this](boost::system::error_code ec, tcp::resolver::iterator) {
+ std::unique_lock<std::mutex> lock(mut_connection_finished_);
if (!ec) {
- std::unique_lock<std::mutex> lock(mut_connection_finished_);
LOG_INFO("Client connected to {}:{}", addr_, port_);
is_connected_ = true;
state_ = client::connection_state::connected;
@@ -55,6 +55,9 @@ struct client::impl {
do_read();
} else {
LOG_ERROR("Error during connection: {}", ec);
+ is_connected_ = false;
+ state_ = client::connection_state::disconnected;
+ conn_finished_.notify_all();
}
});
}