@@ -400,12 +400,12 @@ class CConnman
400
400
401
401
std::vector<ListenSocket> vhListenSocket;
402
402
std::atomic<bool > fNetworkActive ;
403
- banmap_t setBanned;
403
+ banmap_t setBanned GUARDED_BY (cs_setBanned) ;
404
404
CCriticalSection cs_setBanned;
405
- bool setBannedIsDirty;
405
+ bool setBannedIsDirty GUARDED_BY (cs_setBanned) ;
406
406
bool fAddressesInitialized ;
407
407
CAddrMan addrman;
408
- std::deque<std::string> vOneShots;
408
+ std::deque<std::string> vOneShots GUARDED_BY (cs_vOneShots) ;
409
409
CCriticalSection cs_vOneShots;
410
410
std::vector<std::string> vAddedNodes GUARDED_BY (cs_vAddedNodes);
411
411
CCriticalSection cs_vAddedNodes;
@@ -540,7 +540,7 @@ struct LocalServiceInfo {
540
540
};
541
541
542
542
extern CCriticalSection cs_mapLocalHost;
543
- extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
543
+ extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY (cs_mapLocalHost) ;
544
544
typedef std::map<std::string, uint64_t > mapMsgCmdSize; // command, total bytes
545
545
546
546
class CNodeStats
@@ -630,23 +630,23 @@ class CNode
630
630
public:
631
631
// socket
632
632
std::atomic<ServiceFlags> nServices;
633
- SOCKET hSocket;
633
+ SOCKET hSocket GUARDED_BY (cs_hSocket) ;
634
634
size_t nSendSize; // total size of all vSendMsg entries
635
635
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) ;
638
638
CCriticalSection cs_vSend;
639
639
CCriticalSection cs_hSocket;
640
640
CCriticalSection cs_vRecv;
641
641
642
642
CCriticalSection cs_vProcessMsg;
643
- std::list<CNetMessage> vProcessMsg;
643
+ std::list<CNetMessage> vProcessMsg GUARDED_BY (cs_vProcessMsg) ;
644
644
size_t nProcessQueueSize;
645
645
646
646
CCriticalSection cs_sendProcessing;
647
647
648
648
std::deque<CInv> vRecvGetData;
649
- uint64_t nRecvBytes;
649
+ uint64_t nRecvBytes GUARDED_BY (cs_vRecv) ;
650
650
std::atomic<int > nRecvVersion;
651
651
652
652
std::atomic<int64_t > nLastSend;
@@ -662,7 +662,7 @@ class CNode
662
662
// to be printed out, displayed to humans in various forms and so on. So we sanitize it and
663
663
// store the sanitized version in cleanSubVer. The original should be used when dealing with
664
664
// 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) ;
666
666
CCriticalSection cs_SubVer; // used for both cleanSubVer and strSubVer
667
667
bool fWhitelisted ; // This peer can bypass DoS banning.
668
668
bool fFeeler ; // If true this node is being used as a short lived feeler.
@@ -681,7 +681,7 @@ class CNode
681
681
bool fSentAddr ;
682
682
CSemaphoreGrant grantOutbound;
683
683
mutable CCriticalSection cs_filter;
684
- std::unique_ptr<CBloomFilter> pfilter;
684
+ std::unique_ptr<CBloomFilter> pfilter PT_GUARDED_BY (cs_filter) ;
685
685
std::atomic<int > nRefCount;
686
686
687
687
const uint64_t nKeyedNetGroup;
@@ -690,7 +690,7 @@ class CNode
690
690
protected:
691
691
692
692
mapMsgCmdSize mapSendBytesPerMsgCmd;
693
- mapMsgCmdSize mapRecvBytesPerMsgCmd;
693
+ mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY (cs_vRecv) ;
694
694
695
695
public:
696
696
uint256 hashContinue;
@@ -701,18 +701,18 @@ class CNode
701
701
CRollingBloomFilter addrKnown;
702
702
bool fGetAddr ;
703
703
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) ;
706
706
707
707
// inventory based relay
708
- CRollingBloomFilter filterInventoryKnown;
708
+ CRollingBloomFilter filterInventoryKnown GUARDED_BY (cs_inventory) ;
709
709
// Set of transaction ids we still have to announce.
710
710
// They are sorted by the mempool before relay, so the order is not important.
711
711
std::set<uint256> setInventoryTxToSend;
712
712
// List of block ids we still have announce.
713
713
// There is no final sorting before sending, as they are always sent immediately
714
714
// and in the order requested.
715
- std::vector<uint256> vInventoryBlockToSend;
715
+ std::vector<uint256> vInventoryBlockToSend GUARDED_BY (cs_inventory) ;
716
716
CCriticalSection cs_inventory;
717
717
std::set<uint256> setAskFor;
718
718
std::multimap<int64_t , CInv> mapAskFor;
@@ -741,7 +741,7 @@ class CNode
741
741
// Whether a ping is requested.
742
742
std::atomic<bool > fPingQueued ;
743
743
// Minimum fee rate with which to filter inv's to this node
744
- CAmount minFeeFilter;
744
+ CAmount minFeeFilter GUARDED_BY (cs_feeFilter) ;
745
745
CCriticalSection cs_feeFilter;
746
746
CAmount lastSentFeeFilter;
747
747
int64_t nextSendTimeFeeFilter;
@@ -761,10 +761,10 @@ class CNode
761
761
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
762
762
763
763
mutable CCriticalSection cs_addrName;
764
- std::string addrName;
764
+ std::string addrName GUARDED_BY (cs_addrName) ;
765
765
766
766
// Our address, as reported by the peer
767
- CService addrLocal;
767
+ CService addrLocal GUARDED_BY (cs_addrLocal) ;
768
768
mutable CCriticalSection cs_addrLocal;
769
769
public:
770
770
0 commit comments