Browse Source

postpone SAM destination termination

pull/1474/head
orignal 5 years ago
parent
commit
47f384a0e0
  1. 9
      libi2pd_client/SAM.cpp

9
libi2pd_client/SAM.cpp

@ -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
});
}
} }
} }

Loading…
Cancel
Save