mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-28 13:20:55 +02:00
refactor: Get rid of BanMan::SetBannedSetDirty()
This commit is contained in:
parent
d88c0d8440
commit
46709c5f27
@ -55,12 +55,13 @@ void BanMan::DumpBanlist()
|
|||||||
SweepBanned();
|
SweepBanned();
|
||||||
if (!m_is_dirty) return;
|
if (!m_is_dirty) return;
|
||||||
banmap = m_banned;
|
banmap = m_banned;
|
||||||
SetBannedSetDirty(false);
|
m_is_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t n_start = GetTimeMillis();
|
int64_t n_start = GetTimeMillis();
|
||||||
if (!m_ban_db.Write(banmap)) {
|
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(),
|
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();
|
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:
|
private:
|
||||||
void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_cs_banned);
|
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)
|
//!clean unused entries (if bantime has expired)
|
||||||
void SweepBanned() EXCLUSIVE_LOCKS_REQUIRED(m_cs_banned);
|
void SweepBanned() EXCLUSIVE_LOCKS_REQUIRED(m_cs_banned);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user