Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 2,859 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CConnman::AddNewAddresses(const std::vector<CAddress> &vAddr, | void CConnman::AddNewAddresses(const std::vector<CAddress> &vAddr, | ||||
const CAddress &addrFrom, int64_t nTimePenalty) { | const CAddress &addrFrom, int64_t nTimePenalty) { | ||||
addrman.Add(vAddr, addrFrom, nTimePenalty); | addrman.Add(vAddr, addrFrom, nTimePenalty); | ||||
} | } | ||||
std::vector<CAddress> CConnman::GetAddresses() { | std::vector<CAddress> CConnman::GetAddresses() { | ||||
return addrman.GetAddr(); | std::vector<CAddress> addresses = addrman.GetAddr(); | ||||
if (m_banman) { | |||||
addresses.erase(std::remove_if(addresses.begin(), addresses.end(), | |||||
[this](const CAddress &addr) { | |||||
return m_banman->IsDiscouraged( | |||||
addr) || | |||||
m_banman->IsBanned(addr); | |||||
}), | |||||
addresses.end()); | |||||
} | |||||
return addresses; | |||||
} | } | ||||
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 410 Lines • Show Last 20 Lines |