mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
refactor: Get rid of BanMan::SetBannedSetDirty()
This commit is contained in:
parent
d88c0d8440
commit
46709c5f27
2 changed files with 3 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue