Browse Source

initial filtration of bad peers

pull/170/head
orignal 10 years ago
parent
commit
577ba9b397
  1. 2
      Profiling.h
  2. 5
      TunnelPool.cpp

2
Profiling.h

@ -25,6 +25,8 @@ namespace data @@ -25,6 +25,8 @@ namespace data
void Save ();
void Load ();
bool IsBad () const { return !m_NumTunnelsAgreed && m_NumTunnelsDeclined >= 5; };
void TunnelBuildResponse (uint8_t ret);
private:

5
TunnelPool.cpp

@ -263,6 +263,11 @@ namespace tunnel @@ -263,6 +263,11 @@ namespace tunnel
bool isExploratory = (m_LocalDestination == &i2p::context); // TODO: implement it better
auto hop = isExploratory ? i2p::data::netdb.GetRandomRouter (prevHop):
i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop);
if (!isExploratory && hop && hop->GetProfile ()->IsBad ())
{
LogPrint (eLogInfo, "Selected peer for tunnel has bad profile. Selecting another");
hop = i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop);
}
if (!hop)
hop = i2p::data::netdb.GetRandomRouter ();

Loading…
Cancel
Save