Browse Source

don't try to save invalid router

pull/2108/head
orignal 1 month ago
parent
commit
e26682f4cb
  1. 5
      libi2pd/NetDb.cpp
  2. 2
      libi2pd/RouterInfo.h

5
libi2pd/NetDb.cpp

@ -654,7 +654,7 @@ namespace data @@ -654,7 +654,7 @@ namespace data
std::string ident = it.second->GetIdentHashBase64();
if (it.second->IsUpdated ())
{
if (it.second->GetBuffer ())
if (it.second->GetBuffer () && !it.second->IsUnreachable ())
{
// we have something to save
std::shared_ptr<RouterInfo::Buffer> buffer;
@ -663,9 +663,8 @@ namespace data @@ -663,9 +663,8 @@ namespace data
buffer = it.second->CopyBuffer ();
it.second->ScheduleBufferToDelete ();
}
if (buffer && !it.second->IsUnreachable ()) // don't save bad router
if (buffer)
saveToDisk.push_back(std::make_pair(ident, buffer));
it.second->SetUnreachable (false);
}
it.second->SetUpdated (false);
updatedCount++;

2
libi2pd/RouterInfo.h

@ -293,7 +293,7 @@ namespace data @@ -293,7 +293,7 @@ namespace data
void DeleteBuffer () { m_Buffer = nullptr; m_IsBufferScheduledToDelete = false; };
std::shared_ptr<Buffer> GetSharedBuffer () const { return m_Buffer; };
std::shared_ptr<Buffer> CopyBuffer () const;
void ScheduleBufferToDelete () { m_IsBufferScheduledToDelete = false; };
void ScheduleBufferToDelete () { m_IsBufferScheduledToDelete = true; };
bool IsBufferScheduledToDelete () const { return m_IsBufferScheduledToDelete; };
bool IsUpdated () const { return m_IsUpdated; };

Loading…
Cancel
Save