refactor: Get rid of BanMan::SetBannedSetDirty()

This commit is contained in:
Hennadii Stepanov committed 2022-05-24 09:34:05 +02:00
1 parent d88c0d8440
commit 46709c5f27
2 files changed
+3 -10

No files matched your search

+3 -8
View File
@@ -55,12 +55,13 @@ void BanMan::DumpBanlist()
SweepBanned();
if (!m_is_dirty) return;
banmap = m_banned;
SetBannedSetDirty(false);
m_is_dirty = false;
}
int64_t n_start = GetTimeMillis();
if (!m_ban_db.Write(banmap)) {
SetBannedSetDirty(true);
LOCK(m_cs_banned);
m_is_dirty = true;
}
LogPrint(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(),
@@ -202,9 +203,3 @@ void BanMan::SweepBanned()
m_client_interface->BannedListChanged();
}
}
void BanMan::SetBannedSetDirty(bool dirty)
{
LOCK(m_cs_banned); //reuse m_banned lock for the m_is_dirty flag
m_is_dirty = dirty;
}
-2
View File
@@ -81,8 +81,6 @@ public:
private:
void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_cs_banned);
//!set the "dirty" flag for the banlist
void SetBannedSetDirty(bool dirty = true);
//!clean unused entries (if bantime has expired)
void SweepBanned() EXCLUSIVE_LOCKS_REQUIRED(m_cs_banned);