mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
fixed crash on shutdown
This commit is contained in:
parent
e898e6bf82
commit
72a4f8a9a1
16
NetDb.cpp
16
NetDb.cpp
@ -79,10 +79,6 @@ namespace data
|
||||
NetDb::~NetDb ()
|
||||
{
|
||||
Stop ();
|
||||
for (auto l:m_LeaseSets)
|
||||
delete l.second;
|
||||
for (auto r:m_RequestedDestinations)
|
||||
delete r.second;
|
||||
}
|
||||
|
||||
void NetDb::Start ()
|
||||
@ -110,6 +106,7 @@ namespace data
|
||||
Load (m_NetDbPath);
|
||||
}
|
||||
}
|
||||
m_IsRunning = true;
|
||||
m_Thread = new std::thread (std::bind (&NetDb::Run, this));
|
||||
}
|
||||
|
||||
@ -122,13 +119,18 @@ namespace data
|
||||
m_Thread->join ();
|
||||
delete m_Thread;
|
||||
m_Thread = 0;
|
||||
}
|
||||
}
|
||||
for (auto l: m_LeaseSets)
|
||||
delete l.second;
|
||||
m_LeaseSets.clear();
|
||||
for (auto r: m_RequestedDestinations)
|
||||
delete r.second;
|
||||
m_RequestedDestinations.clear ();
|
||||
}
|
||||
|
||||
void NetDb::Run ()
|
||||
{
|
||||
uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0;
|
||||
m_IsRunning = true;
|
||||
while (m_IsRunning)
|
||||
{
|
||||
try
|
||||
@ -220,7 +222,7 @@ namespace data
|
||||
else
|
||||
{
|
||||
LogPrint ("New RouterInfo added");
|
||||
auto r = std::make_shared<RouterInfo> (buf, len);
|
||||
r = std::make_shared<RouterInfo> (buf, len);
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
|
||||
m_RouterInfos[r->GetIdentHash ()] = r;
|
||||
|
Loading…
x
Reference in New Issue
Block a user