Browse Source

Call BannedListChanged outside of cs_setBanned lock

0.16
Jonas Schnelli 7 years ago
parent
commit
57ac471a29
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 30
      src/net.cpp

30
src/net.cpp

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

Loading…
Cancel
Save