aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-03-20 21:28:11 +0200
committerRiccardo Spagni <ric@spagni.net>2016-03-20 21:28:11 +0200
commitf6317ec1c0a9e5644deeea07ee8c392585e39584 (patch)
treed27dd0433249a8bc0ae39c1b7701afaa68a96fea /contrib/epee
parentMerge pull request #735 (diff)
parentepee: fix potential hang on exit (diff)
downloadmonero-f6317ec1c0a9e5644deeea07ee8c392585e39584.tar.xz
Merge pull request #736
2b4cab3 epee: fix potential hang on exit (moneromooo-monero)
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index e4a461203..2f6e52a5b 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -1005,6 +1005,12 @@ POP_WARNINGS
while(local_shared_context->ec == boost::asio::error::would_block)
{
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
+ if (m_stop_signal_sent)
+ {
+ if (sock_.is_open())
+ sock_.close();
+ return false;
+ }
if(local_shared_context->ec == boost::asio::error::would_block && !r)
{
//timeout
@@ -1018,6 +1024,8 @@ POP_WARNINGS
if (ec || !sock_.is_open())
{
_dbg3("Some problems at connect, message: " << ec.message());
+ if (sock_.is_open())
+ sock_.close();
return false;
}