mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
[net, addrman] Remove external dependencies on CAddrInfo objects
CAddrInfo objects are an implementation detail of how AddrMan manages and adds metadata to different records. Encapsulate this logic by updating Select & SelectTriedCollision to return the additional info that the callers need.
This commit is contained in:
@@ -171,13 +171,23 @@ public:
|
||||
//! See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
|
||||
void ResolveCollisions();
|
||||
|
||||
//! Randomly select an address in tried that another address is attempting to evict.
|
||||
CAddrInfo SelectTriedCollision();
|
||||
/**
|
||||
* Randomly select an address in the tried table that another address is
|
||||
* attempting to evict.
|
||||
*
|
||||
* @return CAddress The record for the selected tried peer.
|
||||
* int64_t The last time we attempted to connect to that peer.
|
||||
*/
|
||||
std::pair<CAddress, int64_t> SelectTriedCollision();
|
||||
|
||||
/**
|
||||
* Choose an address to connect to.
|
||||
*
|
||||
* @param[in] newOnly Whether to only select addresses from the new table.
|
||||
* @return CAddress The record for the selected peer.
|
||||
* int64_t The last time we attempted to connect to that peer.
|
||||
*/
|
||||
CAddrInfo Select(bool newOnly = false) const;
|
||||
std::pair<CAddress, int64_t> Select(bool newOnly = false) const;
|
||||
|
||||
/**
|
||||
* Return all or many randomly selected addresses, optionally by network.
|
||||
|
||||
Reference in New Issue
Block a user