This commit is contained in:
orignal
2025-01-28 21:45:26 -05:00
parent 774c606b09
commit 93ec5ac5c4
2 changed files with 1 additions and 14 deletions

View File

@@ -78,8 +78,6 @@ namespace i2p
m_Service->Stop ();
CleanUp (); // GarlicDestination
}
if (m_SavingRouterInfo.valid ())
m_SavingRouterInfo.get ();
}
std::shared_ptr<i2p::data::RouterInfo::Buffer> RouterContext::CopyRouterInfoBuffer () const
@@ -256,21 +254,12 @@ namespace i2p
void RouterContext::UpdateRouterInfo ()
{
std::shared_ptr<i2p::data::RouterInfo::Buffer> buffer;
{
std::lock_guard<std::mutex> l(m_RouterInfoMutex);
m_RouterInfo.CreateBuffer (m_Keys);
buffer = m_RouterInfo.CopyBuffer ();
}
m_RouterInfo.SaveToFile (i2p::fs::DataDirPath (ROUTER_INFO));
m_LastUpdateTime = i2p::util::GetSecondsSinceEpoch ();
// defer saving buffer to disk
if (m_SavingRouterInfo.valid ())
m_SavingRouterInfo.get ();
m_SavingRouterInfo = std::async (std::launch::async,
[buffer = std::move(buffer)]()
{
i2p::data::RouterInfo::SaveToFile (i2p::fs::DataDirPath (ROUTER_INFO), buffer);
});
}
void RouterContext::NewNTCP2Keys ()