[net] Construct addrman outside connman

node.context owns the CAddrMan. CConnman holds a reference to
the CAddrMan.
This commit is contained in:
John Newbery
2020-10-23 09:34:27 +01:00
parent 3530d5d2d8
commit 1c25adf6d2
8 changed files with 21 additions and 11 deletions

View File

@@ -856,7 +856,7 @@ public:
m_onion_binds = connOptions.onion_binds;
}
CConnman(uint64_t seed0, uint64_t seed1, bool network_active = true);
CConnman(uint64_t seed0, uint64_t seed1, CAddrMan& addrman, bool network_active = true);
~CConnman();
bool Start(CScheduler& scheduler, const Options& options);
@@ -1130,7 +1130,7 @@ private:
std::vector<ListenSocket> vhListenSocket;
std::atomic<bool> fNetworkActive{true};
bool fAddressesInitialized{false};
CAddrMan addrman;
CAddrMan& addrman;
std::deque<std::string> m_addr_fetches GUARDED_BY(m_addr_fetches_mutex);
RecursiveMutex m_addr_fetches_mutex;
std::vector<std::string> vAddedNodes GUARDED_BY(cs_vAddedNodes);