From 1b91bebd2e9aff014c018496e7730de8feee1a80 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 12 Sep 2019 11:27:47 +0000 Subject: [PATCH] abstract_tcp_server2: fix lingering connections Resetting the timer after shutdown was initiated would keep a reference to the object inside ASIO, which would keep the connection alive until the timer timed out --- contrib/epee/include/net/abstract_tcp_server2.inl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 12a87071a..729951341 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -736,6 +736,11 @@ PRAGMA_WARNING_DISABLE_VS(4355) MERROR("Resetting timer on a dead object"); return; } + if (m_was_shutdown) + { + MERROR("Setting timer on a shut down object"); + return; + } if (add) ms += m_timer.expires_from_now(); m_timer.expires_from_now(ms);