Skip to content

Commit 37d150d

Browse files
committed
refactor: Add more negative !m_banned_mutex thread safety annotations
Could be verified with $ ./configure CC=clang CXX=clang++ CXXFLAGS='-Wthread-safety -Wthread-safety-negative' $ make clean $ make 2>&1 | grep m_banned_mutex
1 parent 0fb2908 commit 37d150d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/banman.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ class BanMan
6060
public:
6161
~BanMan();
6262
BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time);
63-
void Ban(const CNetAddr& net_addr, int64_t ban_time_offset = 0, bool since_unix_epoch = false);
64-
void Ban(const CSubNet& sub_net, int64_t ban_time_offset = 0, bool since_unix_epoch = false);
65-
void Discourage(const CNetAddr& net_addr);
66-
void ClearBanned();
63+
void Ban(const CNetAddr& net_addr, int64_t ban_time_offset = 0, bool since_unix_epoch = false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
64+
void Ban(const CSubNet& sub_net, int64_t ban_time_offset = 0, bool since_unix_epoch = false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
65+
void Discourage(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
66+
void ClearBanned() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
6767

6868
//! Return whether net_addr is banned
69-
bool IsBanned(const CNetAddr& net_addr);
69+
bool IsBanned(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
7070

7171
//! Return whether sub_net is exactly banned
72-
bool IsBanned(const CSubNet& sub_net);
72+
bool IsBanned(const CSubNet& sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
7373

7474
//! Return whether net_addr is discouraged.
75-
bool IsDiscouraged(const CNetAddr& net_addr);
75+
bool IsDiscouraged(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
7676

77-
bool Unban(const CNetAddr& net_addr);
78-
bool Unban(const CSubNet& sub_net);
79-
void GetBanned(banmap_t& banmap);
80-
void DumpBanlist();
77+
bool Unban(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
78+
bool Unban(const CSubNet& sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
79+
void GetBanned(banmap_t& banmap) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
80+
void DumpBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
8181

8282
private:
8383
void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);

0 commit comments

Comments
 (0)