mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-28 00:44:42 +00:00
1 sec more to mark a tunnel slow if proxy
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user