diff options
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp index 171358bb5f..bf29d928a1 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2539,6 +2539,17 @@ std::vector<CAddress> CConnman::GetAddresses() return addresses; } +std::vector<CAddress> CConnman::GetAddresses(Network requestor_network) +{ + const auto current_time = GetTime<std::chrono::microseconds>(); + if (m_addr_response_caches.find(requestor_network) == m_addr_response_caches.end() || + m_addr_response_caches[requestor_network].m_update_addr_response < current_time) { + m_addr_response_caches[requestor_network].m_addrs_response_cache = GetAddresses(); + m_addr_response_caches[requestor_network].m_update_addr_response = current_time + std::chrono::hours(21) + GetRandMillis(std::chrono::hours(6)); + } + return m_addr_response_caches[requestor_network].m_addrs_response_cache; +} + bool CConnman::AddNode(const std::string& strNode) { LOCK(cs_vAddedNodes); |