Skip to content

Commit

Permalink
don't wait for completion explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jan 29, 2025
1 parent 1bff420 commit 774c606
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions libi2pd/RouterContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ namespace i2p
m_Service->Stop ();
CleanUp (); // GarlicDestination
}
if (m_SavingRouterInfo.valid () && m_SavingRouterInfo.wait_for(std::chrono::seconds(0)) != std::future_status::ready)
m_SavingRouterInfo.wait ();
if (m_SavingRouterInfo.valid ())
m_SavingRouterInfo.get ();
}

std::shared_ptr<i2p::data::RouterInfo::Buffer> RouterContext::CopyRouterInfoBuffer () const
Expand Down Expand Up @@ -265,12 +265,7 @@ namespace i2p
m_LastUpdateTime = i2p::util::GetSecondsSinceEpoch ();
// defer saving buffer to disk
if (m_SavingRouterInfo.valid ())
{
if (m_SavingRouterInfo.wait_for(std::chrono::seconds(0)) != std::future_status::ready)
// wait until previous update complete
m_SavingRouterInfo.wait ();
m_SavingRouterInfo.get ();
}
m_SavingRouterInfo = std::async (std::launch::async,
[buffer = std::move(buffer)]()
{
Expand Down

0 comments on commit 774c606

Please sign in to comment.