Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 2,872 Lines • ▼ Show 20 Lines | if (m_banman) { | ||||
addr) || | addr) || | ||||
m_banman->IsBanned(addr); | m_banman->IsBanned(addr); | ||||
}), | }), | ||||
addresses.end()); | addresses.end()); | ||||
} | } | ||||
return addresses; | 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) { | bool CConnman::AddNode(const std::string &strNode) { | ||||
LOCK(cs_vAddedNodes); | LOCK(cs_vAddedNodes); | ||||
for (const std::string &it : vAddedNodes) { | for (const std::string &it : vAddedNodes) { | ||||
if (strNode == it) { | if (strNode == it) { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 408 Lines • Show Last 20 Lines |