mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-13 11:17:53 +00:00
change shared local destination upon reload
This commit is contained in:
parent
c7db9010ad
commit
85fa728d41
@ -36,13 +36,7 @@ namespace client
|
||||
void ClientContext::Start ()
|
||||
{
|
||||
if (!m_SharedLocalDestination)
|
||||
{
|
||||
m_SharedLocalDestination = CreateNewLocalDestination (); // non-public, DSA
|
||||
m_SharedLocalDestination->Acquire ();
|
||||
m_Destinations[m_SharedLocalDestination->GetIdentity ()->GetIdentHash ()] = m_SharedLocalDestination;
|
||||
m_SharedLocalDestination->Start ();
|
||||
}
|
||||
|
||||
CreateNewSharedLocalDestination ();
|
||||
|
||||
m_AddressBook.Start ();
|
||||
|
||||
@ -267,6 +261,10 @@ namespace client
|
||||
// delete not updated tunnels (not in config anymore)
|
||||
VisitTunnels ([](I2PService * s)->bool { return s->isUpdated; });
|
||||
|
||||
// change shared local destination
|
||||
m_SharedLocalDestination->Release ();
|
||||
CreateNewSharedLocalDestination ();
|
||||
|
||||
// delete unused destinations
|
||||
std::unique_lock<std::mutex> l(m_DestinationsMutex);
|
||||
for (auto it = m_Destinations.begin (); it != m_Destinations.end ();)
|
||||
@ -407,6 +405,14 @@ namespace client
|
||||
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
|
||||
{
|
||||
auto it = m_Destinations.find (destination);
|
||||
|
@ -99,6 +99,8 @@ namespace client
|
||||
template<typename Visitor>
|
||||
void VisitTunnels (Visitor v); // Visitor: (I2PService *) -> bool, true means retain
|
||||
|
||||
void CreateNewSharedLocalDestination ();
|
||||
|
||||
private:
|
||||
|
||||
std::mutex m_DestinationsMutex;
|
||||
|
Loading…
Reference in New Issue
Block a user