diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/net.cpp b/src/net.cpp index 23bf640472..e00faaeecd 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -603,21 +603,28 @@ 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(notifyUI && clientInterface) { + clientInterface->BannedListChanged(); } } |