@@ -400,12 +400,12 @@ class CConnman
400400
401401 std::vector<ListenSocket> vhListenSocket;
402402 std::atomic<bool > fNetworkActive ;
403- banmap_t setBanned;
403+ banmap_t setBanned GUARDED_BY (cs_setBanned) ;
404404 CCriticalSection cs_setBanned;
405- bool setBannedIsDirty;
405+ bool setBannedIsDirty GUARDED_BY (cs_setBanned) ;
406406 bool fAddressesInitialized ;
407407 CAddrMan addrman;
408- std::deque<std::string> vOneShots;
408+ std::deque<std::string> vOneShots GUARDED_BY (cs_vOneShots) ;
409409 CCriticalSection cs_vOneShots;
410410 std::vector<std::string> vAddedNodes GUARDED_BY (cs_vAddedNodes);
411411 CCriticalSection cs_vAddedNodes;
@@ -540,7 +540,7 @@ struct LocalServiceInfo {
540540};
541541
542542extern CCriticalSection cs_mapLocalHost;
543- extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
543+ extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY (cs_mapLocalHost) ;
544544typedef std::map<std::string, uint64_t > mapMsgCmdSize; // command, total bytes
545545
546546class CNodeStats
@@ -630,23 +630,23 @@ class CNode
630630public:
631631 // socket
632632 std::atomic<ServiceFlags> nServices;
633- SOCKET hSocket;
633+ SOCKET hSocket GUARDED_BY (cs_hSocket) ;
634634 size_t nSendSize; // total size of all vSendMsg entries
635635 size_t nSendOffset; // offset inside the first vSendMsg already sent
636- uint64_t nSendBytes;
637- std::deque<std::vector<unsigned char >> vSendMsg;
636+ uint64_t nSendBytes GUARDED_BY (cs_vSend) ;
637+ std::deque<std::vector<unsigned char >> vSendMsg GUARDED_BY (cs_vSend) ;
638638 CCriticalSection cs_vSend;
639639 CCriticalSection cs_hSocket;
640640 CCriticalSection cs_vRecv;
641641
642642 CCriticalSection cs_vProcessMsg;
643- std::list<CNetMessage> vProcessMsg;
643+ std::list<CNetMessage> vProcessMsg GUARDED_BY (cs_vProcessMsg) ;
644644 size_t nProcessQueueSize;
645645
646646 CCriticalSection cs_sendProcessing;
647647
648648 std::deque<CInv> vRecvGetData;
649- uint64_t nRecvBytes;
649+ uint64_t nRecvBytes GUARDED_BY (cs_vRecv) ;
650650 std::atomic<int > nRecvVersion;
651651
652652 std::atomic<int64_t > nLastSend;
@@ -662,7 +662,7 @@ class CNode
662662 // to be printed out, displayed to humans in various forms and so on. So we sanitize it and
663663 // store the sanitized version in cleanSubVer. The original should be used when dealing with
664664 // the network or wire types and the cleaned string used when displayed or logged.
665- std::string strSubVer, cleanSubVer;
665+ std::string strSubVer GUARDED_BY (cs_SubVer) , cleanSubVer GUARDED_BY(cs_SubVer) ;
666666 CCriticalSection cs_SubVer; // used for both cleanSubVer and strSubVer
667667 bool fWhitelisted ; // This peer can bypass DoS banning.
668668 bool fFeeler ; // If true this node is being used as a short lived feeler.
@@ -681,7 +681,7 @@ class CNode
681681 bool fSentAddr ;
682682 CSemaphoreGrant grantOutbound;
683683 mutable CCriticalSection cs_filter;
684- std::unique_ptr<CBloomFilter> pfilter;
684+ std::unique_ptr<CBloomFilter> pfilter PT_GUARDED_BY (cs_filter) ;
685685 std::atomic<int > nRefCount;
686686
687687 const uint64_t nKeyedNetGroup;
@@ -690,7 +690,7 @@ class CNode
690690protected:
691691
692692 mapMsgCmdSize mapSendBytesPerMsgCmd;
693- mapMsgCmdSize mapRecvBytesPerMsgCmd;
693+ mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY (cs_vRecv) ;
694694
695695public:
696696 uint256 hashContinue;
@@ -701,18 +701,18 @@ class CNode
701701 CRollingBloomFilter addrKnown;
702702 bool fGetAddr ;
703703 std::set<uint256> setKnown;
704- int64_t nNextAddrSend;
705- int64_t nNextLocalAddrSend;
704+ int64_t nNextAddrSend GUARDED_BY (cs_sendProcessing) ;
705+ int64_t nNextLocalAddrSend GUARDED_BY (cs_sendProcessing) ;
706706
707707 // inventory based relay
708- CRollingBloomFilter filterInventoryKnown;
708+ CRollingBloomFilter filterInventoryKnown GUARDED_BY (cs_inventory) ;
709709 // Set of transaction ids we still have to announce.
710710 // They are sorted by the mempool before relay, so the order is not important.
711711 std::set<uint256> setInventoryTxToSend;
712712 // List of block ids we still have announce.
713713 // There is no final sorting before sending, as they are always sent immediately
714714 // and in the order requested.
715- std::vector<uint256> vInventoryBlockToSend;
715+ std::vector<uint256> vInventoryBlockToSend GUARDED_BY (cs_inventory) ;
716716 CCriticalSection cs_inventory;
717717 std::set<uint256> setAskFor;
718718 std::multimap<int64_t , CInv> mapAskFor;
@@ -741,7 +741,7 @@ class CNode
741741 // Whether a ping is requested.
742742 std::atomic<bool > fPingQueued ;
743743 // Minimum fee rate with which to filter inv's to this node
744- CAmount minFeeFilter;
744+ CAmount minFeeFilter GUARDED_BY (cs_feeFilter) ;
745745 CCriticalSection cs_feeFilter;
746746 CAmount lastSentFeeFilter;
747747 int64_t nextSendTimeFeeFilter;
@@ -761,10 +761,10 @@ class CNode
761761 std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
762762
763763 mutable CCriticalSection cs_addrName;
764- std::string addrName;
764+ std::string addrName GUARDED_BY (cs_addrName) ;
765765
766766 // Our address, as reported by the peer
767- CService addrLocal;
767+ CService addrLocal GUARDED_BY (cs_addrLocal) ;
768768 mutable CCriticalSection cs_addrLocal;
769769public:
770770
0 commit comments