mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
cleanup unused destinations
This commit is contained in:
parent
c287fb58bd
commit
cded6206dc
@ -38,6 +38,7 @@ namespace client
|
|||||||
if (!m_SharedLocalDestination)
|
if (!m_SharedLocalDestination)
|
||||||
{
|
{
|
||||||
m_SharedLocalDestination = CreateNewLocalDestination (); // non-public, DSA
|
m_SharedLocalDestination = CreateNewLocalDestination (); // non-public, DSA
|
||||||
|
m_SharedLocalDestination->Acquire ();
|
||||||
m_Destinations[m_SharedLocalDestination->GetIdentity ()->GetIdentHash ()] = m_SharedLocalDestination;
|
m_Destinations[m_SharedLocalDestination->GetIdentity ()->GetIdentHash ()] = m_SharedLocalDestination;
|
||||||
m_SharedLocalDestination->Start ();
|
m_SharedLocalDestination->Start ();
|
||||||
}
|
}
|
||||||
@ -246,6 +247,19 @@ namespace client
|
|||||||
i2p::config::ParseConfig(config);
|
i2p::config::ParseConfig(config);
|
||||||
Stop();
|
Stop();
|
||||||
Start();
|
Start();
|
||||||
|
|
||||||
|
// delete unused destinations
|
||||||
|
std::unique_lock<std::mutex> l(m_DestinationsMutex);
|
||||||
|
for (auto it = m_Destinations.begin (); it != m_Destinations.end ();)
|
||||||
|
{
|
||||||
|
auto dest = it->second;
|
||||||
|
if (dest->GetRefCounter () > 0) ++it; // skip
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dest->Stop ();
|
||||||
|
it = m_Destinations.erase (it);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientContext::LoadPrivateKeys (i2p::data::PrivateKeys& keys, const std::string& filename, i2p::data::SigningKeyType sigType)
|
bool ClientContext::LoadPrivateKeys (i2p::data::PrivateKeys& keys, const std::string& filename, i2p::data::SigningKeyType sigType)
|
||||||
|
Loading…
Reference in New Issue
Block a user