// // first work out how many are old enough to kick off.
{
// shared_ptr<Session> worst;
// look for worst peer to kick off
// unsigned agedPeers = 0;
// first work out how many are old enough to kick off.
// for (auto i: m_peers)
shared_ptr<Session>worst;
// if (!dc.count(i.first))
unsignedagedPeers=0;
// if (auto p = i.second.lock())
for(autoi:m_peers)
// if (/*(m_mode != NodeMode::Host || p->m_caps != 0x01) &&*/ chrono::steady_clock::now() > p->m_connect + chrono::milliseconds(old)) // don't throw off new peers; peer-servers should never kick off other peer-servers.
if(!dc.count(i.first))
// {
if(autop=i.second.lock())
// ++agedPeers;
if(/*(m_mode != NodeMode::Host || p->m_caps != 0x01) &&*/chrono::steady_clock::now()>p->m_connect+chrono::milliseconds(old))// don't throw off new peers; peer-servers should never kick off other peer-servers.
std::unique_ptr<boost::asio::deadline_timer>m_timer;///< Timer which, when network is running, calls scheduler() every c_timerInterval ms.
std::unique_ptr<boost::asio::deadline_timer>m_timer;///< Timer which, when network is running, calls scheduler() every c_timerInterval ms.
staticconstunsignedc_timerInterval=100;///< Interval which m_timer is run when network is connected.
staticconstunsignedc_timerInterval=100;///< Interval which m_timer is run when network is connected.
unsignedm_lastTick=0;///< Used by run() for scheduling; must not be mutated outside of run().
std::set<Node*>m_pendingNodeConns;/// Used only by connect(Node&) to limit concurrently connecting to same node. See connect(shared_ptr<Node>const&).
std::set<NodeInfo*>m_pendingNodeConns;/// Used only by connect(NodeInfo&) to limit concurrently connecting to same node. See connect(shared_ptr<NodeInfo>const&).
Mutexx_pendingNodeConns;
Mutexx_pendingNodeConns;
bi::tcp::endpointm_tcpPublic;///< Our public listening endpoint.
bi::tcp::endpointm_tcpPublic;///< Our public listening endpoint.
PeerInfom_info;///< Dynamic information about this peer.
PeerInfom_info;///< Dynamic information about this peer.
unsignedm_protocolVersion=0;///< The protocol version of the peer.
unsignedm_protocolVersion=0;///< The protocol version of the peer.
std::shared_ptr<Node>m_node;///< The Node object. Might be null if we constructed using a bare address/port.
std::shared_ptr<NodeInfo>m_node;///< The NodeInfo object. Might be null if we constructed using a bare address/port.
bi::tcp::endpointm_manualEndpoint;///< The endpoint as specified by the constructor.
bi::tcp::endpointm_manualEndpoint;///< The endpoint as specified by the constructor.
boolm_force=false;///< If true, ignore IDs being different. This could open you up to MitM attacks.
boolm_force=false;///< If true, ignore IDs being different. This could open you up to MitM attacks.
boolm_dropped=false;///< If true, we've already divested ourselves of this peer. We're just waiting for the reads & writes to fail before the shared_ptr goes OOS and the destructor kicks in.
boolm_dropped=false;///< If true, we've already divested ourselves of this peer. We're just waiting for the reads & writes to fail before the shared_ptr goes OOS and the destructor kicks in.