mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-18 23:16:37 +02:00
doesn't create same local destination twice
This commit is contained in:
parent
ed692ffba3
commit
b0052eae05
1 changed files with 13 additions and 3 deletions
|
@ -185,10 +185,20 @@ namespace client
|
|||
LogPrint ("New private keys file ", fullPath, " for ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " created");
|
||||
}
|
||||
|
||||
auto localDestination = new ClientDestination (keys, isPublic);
|
||||
ClientDestination * localDestination = nullptr;
|
||||
std::unique_lock<std::mutex> l(m_DestinationsMutex);
|
||||
auto it = m_Destinations.find (keys.GetPublic ().GetIdentHash ());
|
||||
if (it != m_Destinations.end ())
|
||||
{
|
||||
LogPrint (eLogWarning, "Local destination ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " alreday exists");
|
||||
localDestination = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDestination = new ClientDestination (keys, isPublic);
|
||||
m_Destinations[localDestination->GetIdentHash ()] = localDestination;
|
||||
localDestination->Start ();
|
||||
}
|
||||
return localDestination;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue