MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / IsBad

Method IsBad

libi2pd/Profiling.cpp:228–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226 }
227
228 bool RouterProfile::IsBad ()
229 {
230 if (IsUnreachable () || m_IsDuplicated) return true;
231 auto ts = i2p::util::GetSecondsSinceEpoch ();
232 if (IsDeclinedRecently (ts)) return true;
233 bool checkIsKnown = i2p::tunnel::tunnels.GetPreciseTunnelCreationSuccessRate () < (m_ProfilesRng () % 100);
234 if (checkIsKnown)
235 {
236 if (!m_NumTunnelsAgreed && !m_NumTunnelsDeclined)
237 return true;
238 }
239 bool isBad = false;
240 auto total = m_NumTunnelsAgreed + m_NumTunnelsDeclined;
241 if (total)
242 isBad = m_NumTunnelsAgreed < m_ProfilesRng () % total;
243 else if ((int)m_NumTunnelsNonReplied)
244 isBad = m_ProfilesRng () % (int)m_NumTunnelsNonReplied;
245 if (isBad) m_NumTimesRejected++; else m_NumTimesTaken++;
246 return isBad;
247 }
248
249 bool RouterProfile::IsUnreachable ()
250 {

Callers 2

SelectNextHopMethod · 0.80
StandardSelectPeersMethod · 0.80

Calls 2

GetSecondsSinceEpochFunction · 0.85

Tested by

no test coverage detected