aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-20 12:05:55 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-03-20 12:05:55 +0000
commit2b4cab30fc47539a87b4644c7cf4c657da391c0c (patch)
treee527176b4f01eae8f6bbc8dbcb16b70a56323067 /contrib/epee/include/net
parentMerge pull request #732 (diff)
downloadmonero-2b4cab30fc47539a87b4644c7cf4c657da391c0c.tar.xz
epee: fix potential hang on exit
Also close sockets on failure, just in case
Diffstat (limited to 'contrib/epee/include/net')
-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 698e1947a..1c854dfb7 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;
}