|
|
@ -36,13 +36,7 @@ namespace client |
|
|
|
void ClientContext::Start () |
|
|
|
void ClientContext::Start () |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!m_SharedLocalDestination) |
|
|
|
if (!m_SharedLocalDestination) |
|
|
|
{ |
|
|
|
CreateNewSharedLocalDestination (); |
|
|
|
m_SharedLocalDestination = CreateNewLocalDestination (); // non-public, DSA
|
|
|
|
|
|
|
|
m_SharedLocalDestination->Acquire (); |
|
|
|
|
|
|
|
m_Destinations[m_SharedLocalDestination->GetIdentity ()->GetIdentHash ()] = m_SharedLocalDestination; |
|
|
|
|
|
|
|
m_SharedLocalDestination->Start (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_AddressBook.Start (); |
|
|
|
m_AddressBook.Start (); |
|
|
|
|
|
|
|
|
|
|
@ -267,6 +261,10 @@ namespace client |
|
|
|
// delete not updated tunnels (not in config anymore)
|
|
|
|
// delete not updated tunnels (not in config anymore)
|
|
|
|
VisitTunnels ([](I2PService * s)->bool { return s->isUpdated; }); |
|
|
|
VisitTunnels ([](I2PService * s)->bool { return s->isUpdated; }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// change shared local destination
|
|
|
|
|
|
|
|
m_SharedLocalDestination->Release (); |
|
|
|
|
|
|
|
CreateNewSharedLocalDestination (); |
|
|
|
|
|
|
|
|
|
|
|
// delete unused destinations
|
|
|
|
// delete unused destinations
|
|
|
|
std::unique_lock<std::mutex> l(m_DestinationsMutex); |
|
|
|
std::unique_lock<std::mutex> l(m_DestinationsMutex); |
|
|
|
for (auto it = m_Destinations.begin (); it != m_Destinations.end ();) |
|
|
|
for (auto it = m_Destinations.begin (); it != m_Destinations.end ();) |
|
|
@ -407,6 +405,14 @@ namespace client |
|
|
|
return localDestination; |
|
|
|
return localDestination; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ClientContext::CreateNewSharedLocalDestination () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_SharedLocalDestination = CreateNewLocalDestination (); // non-public, DSA
|
|
|
|
|
|
|
|
m_SharedLocalDestination->Acquire (); |
|
|
|
|
|
|
|
m_Destinations[m_SharedLocalDestination->GetIdentity ()->GetIdentHash ()] = m_SharedLocalDestination; |
|
|
|
|
|
|
|
m_SharedLocalDestination->Start (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<ClientDestination> ClientContext::FindLocalDestination (const i2p::data::IdentHash& destination) const |
|
|
|
std::shared_ptr<ClientDestination> ClientContext::FindLocalDestination (const i2p::data::IdentHash& destination) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto it = m_Destinations.find (destination); |
|
|
|
auto it = m_Destinations.find (destination); |
|
|
|