diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2021-08-25 15:40:59 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2021-09-28 19:02:34 -0400 |
commit | 7cba9d56185b9325ce41d79364e448462fff0f6a (patch) | |
tree | 810167c86f44ed8d730232ec77544668b3bd6c85 /src/addrman_impl.h | |
parent | 8af5b54f973e11c847345418d8631bc301b96130 (diff) |
[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_impl.h')
-rw-r--r-- | src/addrman_impl.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/addrman_impl.h b/src/addrman_impl.h index ee4b55e5c4..6752d5b81d 100644 --- a/src/addrman_impl.h +++ b/src/addrman_impl.h @@ -31,9 +31,9 @@ public: void ResolveCollisions() EXCLUSIVE_LOCKS_REQUIRED(!cs); - CAddrInfo SelectTriedCollision() EXCLUSIVE_LOCKS_REQUIRED(!cs); + std::pair<CAddress, int64_t> SelectTriedCollision() EXCLUSIVE_LOCKS_REQUIRED(!cs); - CAddrInfo Select(bool newOnly) const + std::pair<CAddress, int64_t> Select(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(!cs); std::vector<CAddress> GetAddr(size_t max_addresses, size_t max_pct, std::optional<Network> network) const @@ -161,7 +161,7 @@ private: void Attempt_(const CService &addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs); //! Select an address to connect to, if newOnly is set to true, only the new table is selected from. - CAddrInfo Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs); + std::pair<CAddress, int64_t> Select_(bool newOnly) const EXCLUSIVE_LOCKS_REQUIRED(cs); /** * Return all or many randomly selected addresses, optionally by network. @@ -193,7 +193,7 @@ private: void ResolveCollisions_() EXCLUSIVE_LOCKS_REQUIRED(cs); //! Return a random to-be-evicted tried table address. - CAddrInfo SelectTriedCollision_() EXCLUSIVE_LOCKS_REQUIRED(cs); + std::pair<CAddress, int64_t> SelectTriedCollision_() EXCLUSIVE_LOCKS_REQUIRED(cs); //! Consistency check, taking into account m_consistency_check_ratio. Will std::abort if an inconsistency is detected. void Check() const EXCLUSIVE_LOCKS_REQUIRED(cs); |