|
|
@ -468,8 +468,6 @@ void CConnman::ClearBanned() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CConnman::IsBanned(CNetAddr ip) |
|
|
|
bool CConnman::IsBanned(CNetAddr ip) |
|
|
|
{ |
|
|
|
|
|
|
|
bool fResult = false; |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_setBanned); |
|
|
|
LOCK(cs_setBanned); |
|
|
|
for (banmap_t::iterator it = setBanned.begin(); it != setBanned.end(); it++) |
|
|
|
for (banmap_t::iterator it = setBanned.begin(); it != setBanned.end(); it++) |
|
|
@ -477,27 +475,25 @@ bool CConnman::IsBanned(CNetAddr ip) |
|
|
|
CSubNet subNet = (*it).first; |
|
|
|
CSubNet subNet = (*it).first; |
|
|
|
CBanEntry banEntry = (*it).second; |
|
|
|
CBanEntry banEntry = (*it).second; |
|
|
|
|
|
|
|
|
|
|
|
if(subNet.Match(ip) && GetTime() < banEntry.nBanUntil) |
|
|
|
if (subNet.Match(ip) && GetTime() < banEntry.nBanUntil) { |
|
|
|
fResult = true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return fResult; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CConnman::IsBanned(CSubNet subnet) |
|
|
|
bool CConnman::IsBanned(CSubNet subnet) |
|
|
|
{ |
|
|
|
|
|
|
|
bool fResult = false; |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
LOCK(cs_setBanned); |
|
|
|
LOCK(cs_setBanned); |
|
|
|
banmap_t::iterator i = setBanned.find(subnet); |
|
|
|
banmap_t::iterator i = setBanned.find(subnet); |
|
|
|
if (i != setBanned.end()) |
|
|
|
if (i != setBanned.end()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CBanEntry banEntry = (*i).second; |
|
|
|
CBanEntry banEntry = (*i).second; |
|
|
|
if (GetTime() < banEntry.nBanUntil) |
|
|
|
if (GetTime() < banEntry.nBanUntil) { |
|
|
|
fResult = true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return fResult; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CConnman::Ban(const CNetAddr& addr, const BanReason &banReason, int64_t bantimeoffset, bool sinceUnixEpoch) { |
|
|
|
void CConnman::Ban(const CNetAddr& addr, const BanReason &banReason, int64_t bantimeoffset, bool sinceUnixEpoch) { |
|
|
|