From 06621a2198d2574d75586326b48cb24fa93eefc7 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 7 Dec 2014 16:10:25 -0500 Subject: [PATCH] don't publish to non-responding floodfill twice --- Destination.cpp | 7 +++++-- Destination.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index e5c0fc78..f3d27825 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -234,6 +234,7 @@ namespace client if (msgID == m_PublishReplyToken) { LogPrint (eLogDebug, "Publishing confirmed"); + m_ExcludedFloodfills.clear (); m_PublishReplyToken = 0; i2p::DeleteI2NPMessage (msg); } @@ -268,12 +269,14 @@ namespace client return; } std::set excluded; - auto floodfill = i2p::data::netdb.GetClosestFloodfill (m_LeaseSet->GetIdentHash (), excluded); + auto floodfill = i2p::data::netdb.GetClosestFloodfill (m_LeaseSet->GetIdentHash (), m_ExcludedFloodfills); if (!floodfill) { - LogPrint ("Can't publish LeaseSet. No floodfills found"); + LogPrint ("Can't publish LeaseSet. No more floodfills found"); + m_ExcludedFloodfills.clear (); return; } + m_ExcludedFloodfills.insert (floodfill->GetIdentHash ()); LogPrint (eLogDebug, "Publish LeaseSet of ", GetIdentHash ().ToBase32 ()); m_PublishReplyToken = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (); auto msg = WrapMessage (*floodfill, i2p::CreateDatabaseStoreMsg (m_LeaseSet, m_PublishReplyToken)); diff --git a/Destination.h b/Destination.h index 87a0bb66..82c3d1d7 100644 --- a/Destination.h +++ b/Destination.h @@ -95,6 +95,7 @@ namespace client i2p::data::LeaseSet * m_LeaseSet; bool m_IsPublic; uint32_t m_PublishReplyToken; + std::set m_ExcludedFloodfills; // for publishing i2p::stream::StreamingDestination * m_StreamingDestination; i2p::datagram::DatagramDestination * m_DatagramDestination;