|
|
@ -596,25 +596,27 @@ void CConnman::SetBanned(const banmap_t &banMap) |
|
|
|
void CConnman::SweepBanned() |
|
|
|
void CConnman::SweepBanned() |
|
|
|
{ |
|
|
|
{ |
|
|
|
int64_t now = GetTime(); |
|
|
|
int64_t now = GetTime(); |
|
|
|
|
|
|
|
bool notifyUI = false; |
|
|
|
LOCK(cs_setBanned); |
|
|
|
|
|
|
|
banmap_t::iterator it = setBanned.begin(); |
|
|
|
|
|
|
|
while(it != setBanned.end()) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
CSubNet subNet = (*it).first; |
|
|
|
LOCK(cs_setBanned); |
|
|
|
CBanEntry banEntry = (*it).second; |
|
|
|
banmap_t::iterator it = setBanned.begin(); |
|
|
|
if(now > banEntry.nBanUntil) |
|
|
|
while(it != setBanned.end()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setBanned.erase(it++); |
|
|
|
CSubNet subNet = (*it).first; |
|
|
|
setBannedIsDirty = true; |
|
|
|
CBanEntry banEntry = (*it).second; |
|
|
|
LogPrint(BCLog::NET, "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString()); |
|
|
|
if(now > banEntry.nBanUntil) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
setBanned.erase(it++); |
|
|
|
|
|
|
|
setBannedIsDirty = true; |
|
|
|
|
|
|
|
notifyUI = true; |
|
|
|
|
|
|
|
LogPrint(BCLog::NET, "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
++it; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
++it; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// update UI
|
|
|
|
// update UI
|
|
|
|
if(setBannedIsDirty && clientInterface) { |
|
|
|
if(notifyUI && clientInterface) { |
|
|
|
clientInterface->BannedListChanged(); |
|
|
|
clientInterface->BannedListChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|