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
This commit is contained in:
Hennadii Stepanov 2022-05-24 10:27:30 +02:00
parent 0fb2908708
commit 37d150d8c5
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -60,24 +60,24 @@ class BanMan
public: public:
~BanMan(); ~BanMan();
BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time); BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time);
void Ban(const CNetAddr& net_addr, int64_t ban_time_offset = 0, bool since_unix_epoch = false); void Ban(const CNetAddr& net_addr, int64_t ban_time_offset = 0, bool since_unix_epoch = false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
void Ban(const CSubNet& sub_net, int64_t ban_time_offset = 0, bool since_unix_epoch = false); void Ban(const CSubNet& sub_net, int64_t ban_time_offset = 0, bool since_unix_epoch = false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
void Discourage(const CNetAddr& net_addr); void Discourage(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
void ClearBanned(); void ClearBanned() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
//! Return whether net_addr is banned //! Return whether net_addr is banned
bool IsBanned(const CNetAddr& net_addr); bool IsBanned(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
//! Return whether sub_net is exactly banned //! Return whether sub_net is exactly banned
bool IsBanned(const CSubNet& sub_net); bool IsBanned(const CSubNet& sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
//! Return whether net_addr is discouraged. //! Return whether net_addr is discouraged.
bool IsDiscouraged(const CNetAddr& net_addr); bool IsDiscouraged(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
bool Unban(const CNetAddr& net_addr); bool Unban(const CNetAddr& net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
bool Unban(const CSubNet& sub_net); bool Unban(const CSubNet& sub_net) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
void GetBanned(banmap_t& banmap); void GetBanned(banmap_t& banmap) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
void DumpBanlist(); void DumpBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);
private: private:
void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex); void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex);