Skip to content

Commit

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

Expand Down Expand Up @@ -266,8 +266,9 @@ namespace i2p
// defer saving buffer to disk
if (m_SavingRouterInfo.valid ())
{
// wait until previous update complete
m_SavingRouterInfo.wait ();
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,
Expand Down

0 comments on commit 1bff420

Please sign in to comment.