Skip to content

Commit

Permalink
don't delete buffer of connected routers
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jan 17, 2025
1 parent e4fc278 commit b6319d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions libi2pd/NetDb.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -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 ())
{
Expand Down
3 changes: 2 additions & 1 deletion libi2pd/RouterInfo.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -294,6 +294,7 @@ namespace data
std::shared_ptr<Buffer> GetSharedBuffer () const { return m_Buffer; };
std::shared_ptr<Buffer> CopyBuffer () const;
void ScheduleBufferToDelete () { m_IsBufferScheduledToDelete = true; };
void CancelBufferToDelete () { m_IsBufferScheduledToDelete = false; };
bool IsBufferScheduledToDelete () const { return m_IsBufferScheduledToDelete; };

bool IsUpdated () const { return m_IsUpdated; };
Expand Down

0 comments on commit b6319d7

Please sign in to comment.