1 sec more to mark a tunnel slow if proxy

This commit is contained in:
orignal
2025-12-11 15:23:39 -05:00
parent 8ff60128fe
commit d4ec15361f
4 changed files with 15 additions and 2 deletions
+5
View File
@@ -1284,6 +1284,11 @@ namespace transport
}
}
int Transports::GetLocalDelay () const
{
return (i2p::context.GetStatus () == eRouterStatusProxy) ? 1000 : 0; // 1 sec for proxy. TODO: implement param
}
bool Transports::IsInReservedRange (const boost::asio::ip::address& host) const
{
return IsCheckReserved () && i2p::util::net::IsInReservedRange (host);
+3 -1
View File
@@ -142,7 +142,9 @@ namespace transport
bool IsOnline() const { return m_IsOnline; };
void SetOnline (bool online);
int GetLocalDelay () const; // in millseconds
auto& GetService () { return *m_Service; };
std::shared_ptr<i2p::crypto::X25519Keys> GetNextX25519KeysPair ();
void ReuseX25519KeysPair (std::shared_ptr<i2p::crypto::X25519Keys> pair);
+6
View File
@@ -263,6 +263,12 @@ namespace tunnel
m_State = state;
}
bool Tunnel::IsSlow () const
{
return LatencyIsKnown() && m_Latency > HIGH_LATENCY_PER_HOP*GetNumHops () +
i2p::transport::transports.GetLocalDelay ()*1000;
}
void Tunnel::VisitTunnelHops(TunnelHopVisitor v)
{
// hops are in inverted order, we must return in direct order
+1 -1
View File
@@ -118,7 +118,7 @@ namespace tunnel
bool LatencyFitsRange(int lowerbound, int upperbound) const;
bool LatencyIsKnown() const { return m_Latency != UNKNOWN_LATENCY; }
bool IsSlow () const { return LatencyIsKnown() && m_Latency > HIGH_LATENCY_PER_HOP*GetNumHops (); }
bool IsSlow () const;
/** visit all hops we currently store */
void VisitTunnelHops(TunnelHopVisitor v);