From 7cba9d56185b9325ce41d79364e448462fff0f6a Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Wed, 25 Aug 2021 15:40:59 -0700 Subject: [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. --- src/addrman.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/addrman.h') diff --git a/src/addrman.h b/src/addrman.h index 2135295b89..d176d0a42c 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -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 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 Select(bool newOnly = false) const; /** * Return all or many randomly selected addresses, optionally by network. -- cgit v1.2.3