aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-11-18 21:38:27 -1000
committerJonas Schnelli <dev@jonasschnelli.ch>2017-11-19 12:51:44 -1000
commit57ac471a294fc7039140eed91d217ad1af7fa7af (patch)
treefcc1b50009a09a86641dd178b7bc021768ec27eb /src/net.cpp
parentc8538123a7618343056b8ca2bc7445de8f0620ec (diff)
Call BannedListChanged outside of cs_setBanned lock
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 5860109647..0e6a490e30 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -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();
}
}