Skip to content

Commit 52c0b3e

Browse files
committed
refactor: Add thread safety annotation to BanMan::SweepBanned()
1 parent 3919059 commit 52c0b3e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/banman.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ void BanMan::GetBanned(banmap_t& banmap)
179179

180180
void BanMan::SweepBanned()
181181
{
182+
AssertLockHeld(m_cs_banned);
183+
182184
int64_t now = GetTime();
183185
bool notify_ui = false;
184186
{
185-
LOCK(m_cs_banned);
186187
banmap_t::iterator it = m_banned.begin();
187188
while (it != m_banned.end()) {
188189
CSubNet sub_net = (*it).first;

src/banman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class BanMan
8585
//!set the "dirty" flag for the banlist
8686
void SetBannedSetDirty(bool dirty = true);
8787
//!clean unused entries (if bantime has expired)
88-
void SweepBanned();
88+
void SweepBanned() EXCLUSIVE_LOCKS_REQUIRED(m_cs_banned);
8989

9090
RecursiveMutex m_cs_banned;
9191
banmap_t m_banned GUARDED_BY(m_cs_banned);

0 commit comments

Comments
 (0)