Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | |||||
/** check whether a given address is potentially local */ | /** check whether a given address is potentially local */ | ||||
bool IsLocal(const CService &addr) { | bool IsLocal(const CService &addr) { | ||||
LOCK(cs_mapLocalHost); | LOCK(cs_mapLocalHost); | ||||
return mapLocalHost.count(addr) > 0; | return mapLocalHost.count(addr) > 0; | ||||
} | } | ||||
/** check whether a given network is one we can probably connect to */ | /** check whether a given network is one we can probably connect to */ | ||||
bool IsReachable(enum Network net) { | bool IsReachable(enum Network net) { | ||||
LOCK(cs_mapLocalHost); | return !IsLimited(net); | ||||
return !vfLimited[net]; | |||||
} | } | ||||
/** check whether a given address is in a network we can probably connect to */ | /** check whether a given address is in a network we can probably connect to */ | ||||
bool IsReachable(const CNetAddr &addr) { | bool IsReachable(const CNetAddr &addr) { | ||||
enum Network net = addr.GetNetwork(); | return IsReachable(addr.GetNetwork()); | ||||
return IsReachable(net); | |||||
} | } | ||||
CNode *CConnman::FindNode(const CNetAddr &ip) { | CNode *CConnman::FindNode(const CNetAddr &ip) { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
for (CNode *pnode : vNodes) { | for (CNode *pnode : vNodes) { | ||||
if (static_cast<CNetAddr>(pnode->addr) == ip) { | if (static_cast<CNetAddr>(pnode->addr) == ip) { | ||||
return pnode; | return pnode; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,565 Lines • Show Last 20 Lines |