Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Commit dc251c6

Browse files
committed
Merge pull request #3 from tobbe303/master
fix race condition in tcp_client::connect
2 parents e7c1470 + 25e9b3e commit dc251c6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sources/network/tcp_client.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ tcp_client::connect(const std::string& host, unsigned int port) {
3030

3131
//! async connect
3232
m_socket.async_connect(endpoint, [&](boost::system::error_code error) {
33-
conn_cond_var.notify_one();
34-
3533
if (not error) {
3634
m_is_connected = true;
3735
async_read();
3836
}
37+
conn_cond_var.notify_one();
3938
});
4039

4140
//! start loop and wait for async connect result

0 commit comments

Comments
 (0)