1
diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp
index 097fcb2..ecedbf8 100644
--- a/libi2pd/NetDb.cpp
+++ b/libi2pd/NetDb.cpp
@@ -719,6 +719,8 @@ namespace data
if (r->IsUnreachable () && i2p::transport::transports.IsConnected (ident))
r->SetUnreachable (false);
+ // filter out those unreachables who are NeverDel
+ if (!((r->HasProfile()) && (r->GetProfile()->IsNeverDel())))
if (r->IsUnreachable ())
{
if (r->IsFloodfill ()) deletedFloodfillsCount++;
diff --git a/libi2pd/Profiling.cpp b/libi2pd/Profiling.cpp
index fe7f990..3a0caea 100644
--- a/libi2pd/Profiling.cpp
+++ b/libi2pd/Profiling.cpp
@@ -19,6 +19,8 @@
#include "Timestamp.h"
#include "NetDb.hpp"
#include "Profiling.h"
+#include "Transports.h"
+#include <algorithm>
namespace i2p
{
@@ -35,7 +37,7 @@ namespace data
m_LastUpdateTime (i2p::util::GetSecondsSinceEpoch ()), m_LastAccessTime (0),
m_LastPersistTime (0), m_NumTunnelsAgreed (0), m_NumTunnelsDeclined (0),
m_NumTunnelsNonReplied (0),m_NumTimesTaken (0), m_NumTimesRejected (0),
- m_HasConnected (false), m_IsDuplicated (false)
+ m_HasConnected (false), m_IsDuplicated (false), m_NeverDelete(false)
{
}
@@ -85,6 +87,8 @@ namespace data
std::string path = g_ProfilesStorage.Path(ident);
boost::property_tree::ptree pt;
+ m_NeverDelete = i2p::transport::transports.IsNeverDeletePeer(identHash);
+
if (!i2p::fs::Exists(path))
{
LogPrint(eLogWarning, "Profiling: No profile yet for ", ident);
diff --git a/libi2pd/Profiling.h b/libi2pd/Profiling.h
index 59995b3..1de5db9 100644
--- a/libi2pd/Profiling.h
+++ b/libi2pd/Profiling.h
@@ -78,6 +78,7 @@ namespace data
bool IsUseful() const;
bool IsDuplicated () const { return m_IsDuplicated; };
+ bool IsNeverDel() const { return m_NeverDelete; };
const boost::asio::ip::udp::endpoint& GetLastEndpoint () const { return m_LastEndpoint; }
void SetLastEndpoint (const boost::asio::ip::udp::endpoint& ep) { m_LastEndpoint = ep; }
@@ -107,6 +108,7 @@ namespace data
uint32_t m_NumTimesRejected;
bool m_HasConnected; // successful trusted(incoming or NTCP2) connection
bool m_IsDuplicated;
+ bool m_NeverDelete; // for trust.routers
// connectivity
boost::asio::ip::udp::endpoint m_LastEndpoint; // SSU2 for non-published addresses
};
diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp
index b21426d..d439f16 100644
--- a/libi2pd/Transports.cpp
+++ b/libi2pd/Transports.cpp
@@ -1262,6 +1262,16 @@ namespace transport
return false;
}
+ bool Transports::IsNeverDeletePeer(const i2p::data::IdentHash & identHash) const {
+ std::lock_guard<std::mutex> lock(transports.m_TrustedRoutersMutex);
+ if (std::count(transports.m_TrustedRouters.begin(),
+ transports.m_TrustedRouters.end(), identHash) > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
void Transports::SetOnline (bool online)
{
if (m_IsOnline != online)
diff --git a/libi2pd/Transports.h b/libi2pd/Transports.h
index 6f85669..e7c9c51 100644
--- a/libi2pd/Transports.h
+++ b/libi2pd/Transports.h
@@ -179,6 +179,7 @@ namespace transport
void RestrictRoutesToRouters(const std::set<i2p::data::IdentHash>& routers);
bool IsRestrictedPeer(const i2p::data::IdentHash & ident) const;
+ bool IsNeverDeletePeer(const i2p::data::IdentHash & ident) const;
void PeerTest (bool ipv4 = true, bool ipv6 = true);
For immediate assistance, please email our customer support: [email protected]