From b6319d78bf9cf483cef8e2bf79b02d75a81907e5 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 16 Jan 2025 19:06:33 -0500 Subject: [PATCH] don't delete buffer of connected routers --- libi2pd/NetDb.cpp | 9 ++++++--- libi2pd/RouterInfo.h | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 09182948..48c0a690 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2024, The PurpleI2P Project +* Copyright (c) 2013-2025, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -696,9 +696,12 @@ namespace data r->SetUnreachable (true); } } - // make router reachable back if connected now - if (r->IsUnreachable () && i2p::transport::transports.IsConnected (ident)) + // make router reachable back and don't delete buffer if connected now + if ((r->IsUnreachable () || r->IsBufferScheduledToDelete ()) && i2p::transport::transports.IsConnected (ident)) + { r->SetUnreachable (false); + r->CancelBufferToDelete (); + } if (r->IsUnreachable ()) { diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index 8d11f661..3a4f4fc8 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2024, The PurpleI2P Project +* Copyright (c) 2013-2025, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -294,6 +294,7 @@ namespace data std::shared_ptr GetSharedBuffer () const { return m_Buffer; }; std::shared_ptr CopyBuffer () const; void ScheduleBufferToDelete () { m_IsBufferScheduledToDelete = true; }; + void CancelBufferToDelete () { m_IsBufferScheduledToDelete = false; }; bool IsBufferScheduledToDelete () const { return m_IsBufferScheduledToDelete; }; bool IsUpdated () const { return m_IsUpdated; };