mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
fixed tremination crash
This commit is contained in:
parent
5e5aefa290
commit
c8b935151a
3 changed files with 8 additions and 17 deletions
|
@ -13,7 +13,7 @@ namespace i2p
|
||||||
namespace client
|
namespace client
|
||||||
{
|
{
|
||||||
LeaseSetDestination::LeaseSetDestination (bool isPublic, const std::map<std::string, std::string> * params):
|
LeaseSetDestination::LeaseSetDestination (bool isPublic, const std::map<std::string, std::string> * params):
|
||||||
m_IsRunning (false), m_Thread (nullptr), m_Work (m_Service), m_IsPublic (isPublic),
|
m_IsRunning (false), m_Thread (nullptr), m_IsPublic (isPublic),
|
||||||
m_PublishReplyToken (0), m_PublishConfirmationTimer (m_Service),
|
m_PublishReplyToken (0), m_PublishConfirmationTimer (m_Service),
|
||||||
m_PublishVerificationTimer (m_Service), m_CleanupTimer (m_Service)
|
m_PublishVerificationTimer (m_Service), m_CleanupTimer (m_Service)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,8 @@ namespace client
|
||||||
Stop ();
|
Stop ();
|
||||||
if (m_Pool)
|
if (m_Pool)
|
||||||
i2p::tunnel::tunnels.DeleteTunnelPool (m_Pool);
|
i2p::tunnel::tunnels.DeleteTunnelPool (m_Pool);
|
||||||
|
for (auto& it: m_LeaseSetRequests)
|
||||||
|
it.second->Complete (nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeaseSetDestination::Run ()
|
void LeaseSetDestination::Run ()
|
||||||
|
@ -110,12 +112,12 @@ namespace client
|
||||||
{
|
{
|
||||||
m_IsRunning = true;
|
m_IsRunning = true;
|
||||||
m_Pool->SetLocalDestination (shared_from_this ());
|
m_Pool->SetLocalDestination (shared_from_this ());
|
||||||
m_Pool->SetActive (true);
|
m_Pool->SetActive (true);
|
||||||
m_Thread = new std::thread (std::bind (&LeaseSetDestination::Run, shared_from_this ()));
|
|
||||||
|
|
||||||
m_CleanupTimer.expires_from_now (boost::posix_time::minutes (DESTINATION_CLEANUP_TIMEOUT));
|
m_CleanupTimer.expires_from_now (boost::posix_time::minutes (DESTINATION_CLEANUP_TIMEOUT));
|
||||||
m_CleanupTimer.async_wait (std::bind (&LeaseSetDestination::HandleCleanupTimer,
|
m_CleanupTimer.async_wait (std::bind (&LeaseSetDestination::HandleCleanupTimer,
|
||||||
shared_from_this (), std::placeholders::_1));
|
shared_from_this (), std::placeholders::_1));
|
||||||
|
m_Thread = new std::thread (std::bind (&LeaseSetDestination::Run, shared_from_this ()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -129,13 +131,6 @@ namespace client
|
||||||
m_CleanupTimer.cancel ();
|
m_CleanupTimer.cancel ();
|
||||||
m_PublishConfirmationTimer.cancel ();
|
m_PublishConfirmationTimer.cancel ();
|
||||||
m_PublishVerificationTimer.cancel ();
|
m_PublishVerificationTimer.cancel ();
|
||||||
|
|
||||||
for (auto& it: m_LeaseSetRequests)
|
|
||||||
{
|
|
||||||
it.second->Complete (nullptr);
|
|
||||||
it.second->requestTimeoutTimer.cancel ();
|
|
||||||
}
|
|
||||||
m_LeaseSetRequests.clear ();
|
|
||||||
|
|
||||||
m_IsRunning = false;
|
m_IsRunning = false;
|
||||||
if (m_Pool)
|
if (m_Pool)
|
||||||
|
|
|
@ -137,7 +137,6 @@ namespace client
|
||||||
volatile bool m_IsRunning;
|
volatile bool m_IsRunning;
|
||||||
std::thread * m_Thread;
|
std::thread * m_Thread;
|
||||||
boost::asio::io_service m_Service;
|
boost::asio::io_service m_Service;
|
||||||
boost::asio::io_service::work m_Work;
|
|
||||||
mutable std::mutex m_RemoteLeaseSetsMutex;
|
mutable std::mutex m_RemoteLeaseSetsMutex;
|
||||||
std::map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
|
std::map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
|
||||||
std::map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
|
std::map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
|
||||||
|
|
|
@ -392,10 +392,7 @@ namespace garlic
|
||||||
|
|
||||||
GarlicDestination::~GarlicDestination ()
|
GarlicDestination::~GarlicDestination ()
|
||||||
{
|
{
|
||||||
m_Sessions.clear ();
|
LogPrint (eLogInfo, "Garlic: destination destroyed");
|
||||||
m_DeliveryStatusSessions.clear ();
|
|
||||||
m_Tags.clear ();
|
|
||||||
LogPrint (eLogInfo, "Garlic: destination destoryed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GarlicDestination::AddSessionKey (const uint8_t * key, const uint8_t * tag)
|
void GarlicDestination::AddSessionKey (const uint8_t * key, const uint8_t * tag)
|
||||||
|
|
Loading…
Add table
Reference in a new issue