diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-15 10:42:59 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-12-15 10:43:34 +0100 |
commit | 8585bb8f058441b951b8012de8c0e45207528dec (patch) | |
tree | beeab19af8b9c140e9a95d71c033c68315df89c1 /src/net.cpp | |
parent | c66adb286a89738a6a5218be2ecfea8e398878dd (diff) | |
parent | 57ac471a294fc7039140eed91d217ad1af7fa7af (diff) |
Merge #11616: Update ban-state in case of dirty-state during periodic sweep
57ac471 Call BannedListChanged outside of cs_setBanned lock (Jonas Schnelli)
c853812 Update ban-state in case of dirty-state during periodic sweep (Jonas Schnelli)
Pull request description:
We do currently not update the UI during periodic ban list sweeps (via dump banlist).
Fixes #11612
Tree-SHA512: bffbdcc03c63042177bdd511b0a9187c211c2b5011178481e8ee3e43a71eef1e4cd6b72f73672babab142b644f62f8b56f0aac1d26d3f19372b1f8644fec9395
Diffstat (limited to 'src/net.cpp')
-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(); } } |