| 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 | { |
no test coverage detected