34 bool Peer::shouldReconnect()
const 36 return id && endpoint && chrono::system_clock::now() > m_lastAttempted + chrono::seconds(fallbackSeconds());
39 unsigned Peer::fallbackSeconds()
const 41 if (peerType == PeerType::Required)
43 switch (m_lastDisconnect)
46 return 30 * (m_failedAttempts + 1);
49 return 25 * (m_failedAttempts + 1);
51 return 15 * (m_failedAttempts + 1);
54 if (m_failedAttempts < 5)
55 return m_failedAttempts ? m_failedAttempts * 5 : 5;
56 else if (m_failedAttempts < 15)
57 return 25 + (m_failedAttempts - 5) * 10;
59 return 25 + 100 + (m_failedAttempts - 15) * 20;
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::hash for asio::adress
unsigned m_failedAttempts
int m_score
All time cumulative.
std::chrono::system_clock::time_point m_lastAttempted
Representation of connectivity state and all other pertinent Peer metadata.
bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)