diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/RouterContext.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/RouterContext.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/RouterContext.cpp 2025-01-29 02:30:48.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/RouterContext.cpp 2025-01-29 02:22:36.000000000 +0000 @@ -79,6 +79,6 @@ CleanUp (); // GarlicDestination } - if (m_SavingRouterInfo.valid ()) - m_SavingRouterInfo.get (); + if (m_SavingRouterInfo.valid () && m_SavingRouterInfo.wait_for(std::chrono::seconds(0)) != std::future_status::ready) + m_SavingRouterInfo.wait (); } @@ -266,5 +266,10 @@ // 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)]()