From 3683ec6a959ff97c5ec578fa652ac0c33cccdb15 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 22 Jul 2022 15:16:42 -0400 Subject: [PATCH] fixed race condition --- libi2pd/NetDb.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 42d73c97..e36e4f13 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -271,7 +271,10 @@ namespace data if (r->IsNewer (buf, len)) { bool wasFloodfill = r->IsFloodfill (); - r->Update (buf, len); + { + std::unique_lock l(m_RouterInfosMutex); + r->Update (buf, len); + } LogPrint (eLogInfo, "NetDb: RouterInfo updated: ", ident.ToBase64()); if (wasFloodfill != r->IsFloodfill ()) // if floodfill status updated {