aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2015-07-03 09:26:51 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2015-10-02 11:38:14 +0200
commit57c77fe4d318a156d98606ee74f0064b22c31631 (patch)
tree6ff3f66d1377fdf71859fcdbb52f2da5a1e3e60e
parent5ab5dca6f1bb1eccd47ea64834acc4fee0435b73 (diff)
banlist: update set dirty to be more fine grained
- move the SetBannedSetDirty(false) call from DumpData() into DumpBanlist() - ensure we only set false, if the write succeeded
-rw-r--r--src/net.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 87c4f0af0a..b13177fe25 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1455,10 +1455,7 @@ void DumpData()
DumpAddresses();
if (CNode::BannedSetIsDirty())
- {
DumpBanlist();
- CNode::SetBannedSetDirty(false);
- }
}
void static ProcessOneShot()
@@ -2484,14 +2481,14 @@ bool CBanDB::Read(banmap_t& banSet)
void DumpBanlist()
{
int64_t nStart = GetTimeMillis();
-
- CNode::SweepBanned(); //clean unused entries (if bantime has expired)
+ CNode::SweepBanned(); // clean unused entries (if bantime has expired)
CBanDB bandb;
banmap_t banmap;
CNode::GetBanned(banmap);
- bandb.Write(banmap);
+ if (bandb.Write(banmap))
+ CNode::SetBannedSetDirty(false);
LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
- banmap.size(), GetTimeMillis() - nStart);
+ banmap.size(), GetTimeMillis() - nStart);
}