aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2021-08-25 15:40:59 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2021-09-28 19:02:34 -0400
commit7cba9d56185b9325ce41d79364e448462fff0f6a (patch)
tree810167c86f44ed8d730232ec77544668b3bd6c85 /src/addrman.h
parent8af5b54f973e11c847345418d8631bc301b96130 (diff)
downloadbitcoin-7cba9d56185b9325ce41d79364e448462fff0f6a.tar.xz
[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.
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h16
1 files changed, 13 insertions, 3 deletions
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<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.