@@ -652,7 +652,7 @@ class CNode
652652 * @return True if the peer should stay connected,
653653 * False if the peer should be disconnected from.
654654 */
655- bool ReceiveMsgBytes (Span<const uint8_t > msg_bytes, bool & complete);
655+ bool ReceiveMsgBytes (Span<const uint8_t > msg_bytes, bool & complete) EXCLUSIVE_LOCKS_REQUIRED(!cs_vRecv) ;
656656
657657 void SetCommonVersion (int greatest_common_version)
658658 {
@@ -664,9 +664,9 @@ class CNode
664664 return m_greatest_common_version;
665665 }
666666
667- CService GetAddrLocal () const LOCKS_EXCLUDED( m_addr_local_mutex);
667+ CService GetAddrLocal () const EXCLUSIVE_LOCKS_REQUIRED(! m_addr_local_mutex);
668668 // ! May not be called more than once
669- void SetAddrLocal (const CService& addrLocalIn) LOCKS_EXCLUDED( m_addr_local_mutex);
669+ void SetAddrLocal (const CService& addrLocalIn) EXCLUSIVE_LOCKS_REQUIRED(! m_addr_local_mutex);
670670
671671 CNode* AddRef ()
672672 {
@@ -679,9 +679,9 @@ class CNode
679679 nRefCount--;
680680 }
681681
682- void CloseSocketDisconnect (CConnman* connman);
682+ void CloseSocketDisconnect (CConnman* connman) EXCLUSIVE_LOCKS_REQUIRED(!m_sock_mutex) ;
683683
684- void copyStats (CNodeStats &stats, const std::vector<bool > &m_asmap);
684+ void copyStats (CNodeStats &stats, const std::vector<bool > &m_asmap) EXCLUSIVE_LOCKS_REQUIRED(!m_subver_mutex, !m_addr_local_mutex, !cs_vSend, !cs_vRecv) ;
685685
686686 ServiceFlags GetLocalServices () const
687687 {
@@ -857,7 +857,7 @@ friend class CNode;
857857 bool m_i2p_accept_incoming;
858858 };
859859
860- void Init (const Options& connOptions) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
860+ void Init (const Options& connOptions) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex, ! m_total_bytes_sent_mutex)
861861 {
862862 AssertLockNotHeld (m_total_bytes_sent_mutex);
863863
@@ -891,7 +891,8 @@ friend class CNode;
891891 CConnman (uint64_t seed0, uint64_t seed1, CAddrMan& addrman, bool network_active = true );
892892 ~CConnman ();
893893 bool Start (CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, CMasternodeSync& mn_sync,
894- CScheduler& scheduler, const Options& options) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
894+ CScheduler& scheduler, const Options& options)
895+ EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !m_added_nodes_mutex, !m_addr_fetches_mutex, !mutexMsgProc);
895896
896897 void StopThreads ();
897898 void StopNodes ();
@@ -901,7 +902,7 @@ friend class CNode;
901902 StopNodes ();
902903 };
903904
904- void Interrupt ();
905+ void Interrupt () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
905906 bool GetNetworkActive () const { return fNetworkActive ; };
906907 bool GetUseAddrmanOutgoing () const { return m_use_addrman_outgoing; };
907908 void SetNetworkActive (bool active, CMasternodeSync* const mn_sync);
@@ -917,8 +918,13 @@ friend class CNode;
917918 IsConnection,
918919 };
919920
920- void OpenNetworkConnection (const CAddress& addrConnect, bool fCountFailure , CSemaphoreGrant* grantOutbound, const char * strDest, ConnectionType conn_type, MasternodeConn masternode_connection = MasternodeConn::IsNotConnection, MasternodeProbeConn masternode_probe_connection = MasternodeProbeConn::IsNotConnection);
921- void OpenMasternodeConnection (const CAddress& addrConnect, MasternodeProbeConn probe = MasternodeProbeConn::IsConnection);
921+ void OpenNetworkConnection (const CAddress& addrConnect, bool fCountFailure , CSemaphoreGrant* grantOutbound,
922+ const char * strDest, ConnectionType conn_type,
923+ MasternodeConn masternode_connection = MasternodeConn::IsNotConnection,
924+ MasternodeProbeConn masternode_probe_connection = MasternodeProbeConn::IsNotConnection)
925+ EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
926+ void OpenMasternodeConnection (const CAddress& addrConnect, MasternodeProbeConn probe = MasternodeProbeConn::IsConnection)
927+ EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
922928 bool CheckIncomingNonce (uint64_t nonce);
923929
924930 struct CFullyConnectedOnly {
@@ -959,7 +965,8 @@ friend class CNode;
959965
960966 bool IsMasternodeOrDisconnectRequested (const CService& addr);
961967
962- void PushMessage (CNode* pnode, CSerializedNetMsg&& msg) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
968+ void PushMessage (CNode* pnode, CSerializedNetMsg&& msg)
969+ EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc, !m_total_bytes_sent_mutex);
963970
964971 template <typename Condition, typename Callable>
965972 bool ForEachNodeContinueIf (const Condition& cond, Callable&& func)
@@ -1099,9 +1106,9 @@ friend class CNode;
10991106 // Count the number of block-relay-only peers we have over our limit.
11001107 int GetExtraBlockRelayCount () const ;
11011108
1102- bool AddNode (const std::string& node);
1103- bool RemoveAddedNode (const std::string& node);
1104- std::vector<AddedNodeInfo> GetAddedNodeInfo () const ;
1109+ bool AddNode (const std::string& node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) ;
1110+ bool RemoveAddedNode (const std::string& node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) ;
1111+ std::vector<AddedNodeInfo> GetAddedNodeInfo () const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex) ;
11051112
11061113 /* *
11071114 * Attempts to open a connection. Currently only used from tests.
@@ -1114,7 +1121,7 @@ friend class CNode;
11141121 * - Max total outbound connection capacity filled
11151122 * - Max connection capacity for type is filled
11161123 */
1117- bool AddConnection (const std::string& address, ConnectionType conn_type);
1124+ bool AddConnection (const std::string& address, ConnectionType conn_type) EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
11181125
11191126 bool AddPendingMasternode (const uint256& proTxHash);
11201127 void SetMasternodeQuorumNodes (Consensus::LLMQType llmqType, const uint256& quorumHash, const std::set<uint256>& proTxHashes);
@@ -1166,8 +1173,8 @@ friend class CNode;
11661173
11671174 unsigned int GetReceiveFloodSize () const ;
11681175
1169- void WakeMessageHandler ();
1170- void WakeSelect ();
1176+ void WakeMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
1177+ void WakeSelect () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
11711178
11721179 /* * Attempts to obfuscate tx time through exponentially distributed emitting.
11731180 Works assuming that a single interval is used.
@@ -1221,13 +1228,15 @@ friend class CNode;
12211228 const std::vector<NetWhitebindPermissions>& whiteBinds,
12221229 const std::vector<CService>& onion_binds);
12231230
1224- void ThreadOpenAddedConnections ();
1225- void AddAddrFetch (const std::string& strDest);
1226- void ProcessAddrFetch ();
1227- void ThreadOpenConnections (const std::vector<std::string> connect, CDeterministicMNManager& dmnman);
1228- void ThreadMessageHandler ();
1229- void ThreadI2PAcceptIncoming (CMasternodeSync& mn_sync);
1230- void AcceptConnection (const ListenSocket& hListenSocket, CMasternodeSync& mn_sync);
1231+ void ThreadOpenAddedConnections () EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex, !mutexMsgProc);
1232+ void AddAddrFetch (const std::string& strDest) EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex);
1233+ void ProcessAddrFetch () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !mutexMsgProc);
1234+ void ThreadOpenConnections (const std::vector<std::string> connect, CDeterministicMNManager& dmnman)
1235+ EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_added_nodes_mutex, !m_nodes_mutex, !mutexMsgProc);
1236+ void ThreadMessageHandler () EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
1237+ void ThreadI2PAcceptIncoming (CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
1238+ void AcceptConnection (const ListenSocket& hListenSocket, CMasternodeSync& mn_sync)
1239+ EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
12311240
12321241 /* *
12331242 * Create a `CNode` object from a socket that has just been accepted and add the node to
@@ -1241,7 +1250,7 @@ friend class CNode;
12411250 NetPermissionFlags permissionFlags,
12421251 const CAddress& addr_bind,
12431252 const CAddress& addr,
1244- CMasternodeSync& mn_sync);
1253+ CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
12451254
12461255 void DisconnectNodes ();
12471256 void NotifyNumConnectionsChanged (CMasternodeSync& mn_sync);
@@ -1305,7 +1314,7 @@ friend class CNode;
13051314 /* *
13061315 * Check connected and listening sockets for IO readiness and process them accordingly.
13071316 */
1308- void SocketHandler (CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
1317+ void SocketHandler (CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !mutexMsgProc );
13091318
13101319 /* *
13111320 * Do the read/write for connected sockets that are ready for IO.
@@ -1319,18 +1328,20 @@ friend class CNode;
13191328 const std::set<SOCKET>& recv_set,
13201329 const std::set<SOCKET>& send_set,
13211330 const std::set<SOCKET>& error_set)
1322- EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
1331+ EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !mutexMsgProc );
13231332
13241333 /* *
13251334 * Accept incoming connections, one from each read-ready listening socket.
13261335 * @param[in] recv_set Sockets that are ready for read.
13271336 */
1328- void SocketHandlerListening (const std::set<SOCKET>& recv_set, CMasternodeSync& mn_sync);
1337+ void SocketHandlerListening (const std::set<SOCKET>& recv_set, CMasternodeSync& mn_sync)
1338+ EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc);
13291339
1330- void ThreadSocketHandler (CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
1331- void ThreadDNSAddressSeed ();
1340+ void ThreadSocketHandler (CMasternodeSync& mn_sync) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !mutexMsgProc );
1341+ void ThreadDNSAddressSeed () EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_nodes_mutex) ;
13321342 void ThreadOpenMasternodeConnections (CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman,
1333- CMasternodeSync& mn_sync);
1343+ CMasternodeSync& mn_sync)
1344+ EXCLUSIVE_LOCKS_REQUIRED(!m_addr_fetches_mutex, !m_nodes_mutex, !mutexMsgProc);
13341345
13351346 uint64_t CalculateKeyedNetGroup (const CAddress& ad) const ;
13361347
@@ -1354,7 +1365,7 @@ friend class CNode;
13541365 NodeId GetNewNodeId ();
13551366
13561367 size_t SocketSendData (CNode& node) EXCLUSIVE_LOCKS_REQUIRED(node.cs_vSend);
1357- size_t SocketRecvData (CNode* pnode);
1368+ size_t SocketRecvData (CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED(!mutexMsgProc) ;
13581369 void DumpAddresses ();
13591370
13601371 // Network stats
0 commit comments