1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 04:04:16 +00:00

postpone SAM destination termination

This commit is contained in:
orignal 2020-02-17 15:14:35 -05:00
parent 88594887f9
commit 47f384a0e0

View File

@ -1161,6 +1161,15 @@ namespace client
session->localDestination->Release ();
session->localDestination->StopAcceptingStreams ();
session->CloseStreams ();
if (m_IsSingleThread)
{
auto timer = std::make_shared<boost::asio::deadline_timer>(GetService ());
timer->expires_from_now (boost::posix_time::seconds(5)); // postpone destination clean for 5 seconds
timer->async_wait ([timer, session](const boost::system::error_code& ecode)
{
// session's destructor is called here
});
}
}
}