mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
postpone SAM destination termination
This commit is contained in:
@@ -1161,6 +1161,15 @@ namespace client
|
|||||||
session->localDestination->Release ();
|
session->localDestination->Release ();
|
||||||
session->localDestination->StopAcceptingStreams ();
|
session->localDestination->StopAcceptingStreams ();
|
||||||
session->CloseStreams ();
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user