diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 74a619d0..ecfe2158 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -957,8 +957,10 @@ namespace data LogPrint (eLogDebug, "NetDb: Found new/outdated router. Requesting RouterInfo..."); if(m_FloodfillBootstrap) RequestDestinationFrom(router, m_FloodfillBootstrap->GetIdentHash(), true); - else + else if (!IsRouterBanned (router)) RequestDestination (router); + else + LogPrint (eLogDebug, "NetDb: Router ", peerHash, " is banned. Skipped"); } else LogPrint (eLogDebug, "NetDb: [:|||:]"); diff --git a/libi2pd/Profiling.cpp b/libi2pd/Profiling.cpp index 2031fa39..3a2db9a5 100644 --- a/libi2pd/Profiling.cpp +++ b/libi2pd/Profiling.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2023, The PurpleI2P Project +* Copyright (c) 2013-2024, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -245,6 +245,15 @@ namespace data return profile; } + bool IsRouterBanned (const IdentHash& identHash) + { + std::unique_lock l(g_ProfilesMutex); + auto it = g_Profiles.find (identHash); + if (it != g_Profiles.end ()) + return it->second->IsUnreachable (); + return false; + } + void InitProfilesStorage () { g_ProfilesStorage.SetPlace(i2p::fs::GetDataDir()); diff --git a/libi2pd/Profiling.h b/libi2pd/Profiling.h index ed23fb12..c4aa6a9a 100644 --- a/libi2pd/Profiling.h +++ b/libi2pd/Profiling.h @@ -87,6 +87,7 @@ namespace data }; std::shared_ptr GetRouterProfile (const IdentHash& identHash); + bool IsRouterBanned (const IdentHash& identHash); // check only existing profiles void InitProfilesStorage (); void DeleteObsoleteProfiles (); void SaveProfiles ();