|
@ -547,35 +547,29 @@ void CNode::ClearBanned() |
|
|
|
|
|
|
|
|
bool CNode::IsBanned(CNetAddr ip) |
|
|
bool CNode::IsBanned(CNetAddr ip) |
|
|
{ |
|
|
{ |
|
|
bool fResult = false; |
|
|
LOCK(cs_setBanned); |
|
|
|
|
|
for (std::map<CSubNet, int64_t>::iterator it = setBanned.begin(); it != setBanned.end(); it++) |
|
|
{ |
|
|
{ |
|
|
LOCK(cs_setBanned); |
|
|
CSubNet subNet = (*it).first; |
|
|
for (std::map<CSubNet, int64_t>::iterator it = setBanned.begin(); it != setBanned.end(); it++) |
|
|
int64_t t = (*it).second; |
|
|
{ |
|
|
|
|
|
CSubNet subNet = (*it).first; |
|
|
|
|
|
int64_t t = (*it).second; |
|
|
|
|
|
|
|
|
|
|
|
if(subNet.Match(ip) && GetTime() < t) |
|
|
if(subNet.Match(ip) && GetTime() < t) |
|
|
fResult = true; |
|
|
return true; |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
return fResult; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool CNode::IsBanned(CSubNet subnet) |
|
|
bool CNode::IsBanned(CSubNet subnet) |
|
|
{ |
|
|
{ |
|
|
bool fResult = false; |
|
|
LOCK(cs_setBanned); |
|
|
|
|
|
std::map<CSubNet, int64_t>::iterator i = setBanned.find(subnet); |
|
|
|
|
|
if (i != setBanned.end()) |
|
|
{ |
|
|
{ |
|
|
LOCK(cs_setBanned); |
|
|
int64_t t = (*i).second; |
|
|
std::map<CSubNet, int64_t>::iterator i = setBanned.find(subnet); |
|
|
if (GetTime() < t) |
|
|
if (i != setBanned.end()) |
|
|
return true; |
|
|
{ |
|
|
|
|
|
int64_t t = (*i).second; |
|
|
|
|
|
if (GetTime() < t) |
|
|
|
|
|
fResult = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
return fResult; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset, bool sinceUnixEpoch) { |
|
|
void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset, bool sinceUnixEpoch) { |
|
|