From 57c77fe4d318a156d98606ee74f0064b22c31631 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 3 Jul 2015 09:26:51 +0200 Subject: [PATCH] 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 --- src/net.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 87c4f0af0..b13177fe2 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); }