mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge bitcoin/bitcoin#26036: net: add NetEventsInterface::g_msgproc_mutex
d575a675ccnet_processing: add thread safety annotation for m_highest_fast_announce (Anthony Towns)0ae7987f68net_processing: add thread safety annotations for PeerManagerImpl members accessed only via the msgproc thread (Anthony Towns)a66a7ccb82net_processing: add thread safety annotations for Peer members accessed only via the msgproc thread (Anthony Towns)bf12abe454net: drop cs_sendProcessing (Anthony Towns)1e78f566d5net: add NetEventsInterface::g_msgproc_mutex (Anthony Towns) Pull request description: There are many cases where we assume message processing is single-threaded in order for how we access node-related memory to be safe. Add an explicit mutex that we can use to document this, which allows the compiler to catch any cases where we try to access that memory from other threads and break that assumption. ACKs for top commit: MarcoFalke: review ACKd575a675cc📽 dergoegge: Code review ACKd575a675ccw0xlt: ACKd575a675ccvasild: ACKd575a675ccmodulo the missing runtime checks Tree-SHA512: b886d1aa4adf318ae64e32ccaf3d508dbb79d6eed3f1fa9d8b2ed96f3c72a3d38cd0f12e05826c9832a2a1302988adfd2b43ea9691aa844f37d8f5c37ff20e05
This commit is contained in:
@@ -805,6 +805,8 @@ BOOST_AUTO_TEST_CASE(LocalAddress_BasicLifecycle)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(initial_advertise_from_version_message)
|
||||
{
|
||||
LOCK(NetEventsInterface::g_msgproc_mutex);
|
||||
|
||||
// Tests the following scenario:
|
||||
// * -bind=3.4.5.6:20001 is specified
|
||||
// * we make an outbound connection to a peer
|
||||
@@ -889,10 +891,7 @@ BOOST_AUTO_TEST_CASE(initial_advertise_from_version_message)
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
LOCK(peer.cs_sendProcessing);
|
||||
m_node.peerman->SendMessages(&peer);
|
||||
}
|
||||
m_node.peerman->SendMessages(&peer);
|
||||
|
||||
BOOST_CHECK(sent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user