aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-25 11:55:20 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-11-25 11:55:37 +0100
commit76392b042e98fcdb3b7ce3c2023003910326d14e (patch)
tree3d585b202bb34264a2d94c368c9bc5d79a7cbf8f /src/test
parent791dd1f41ed787516169a33a590ca42b53f8b8fb (diff)
parent3726a4595837b66d37f151faf1cec2796d6b74d7 (diff)
Merge bitcoin/bitcoin#22829: refactor: various RecursiveMutex replacements in CConnman
3726a4595837b66d37f151faf1cec2796d6b74d7 refactor: replace RecursiveMutex m_added_nodes_mutex with Mutex (Sebastian Falbesoner) 7d52ff5c389643cde613d86fee33d7087f47b8b4 refactor: replace RecursiveMutex m_addr_fetches_mutex with Mutex (Sebastian Falbesoner) d51d2a3bb5b0011efa1b4f1e2c9512a16ce9b347 scripted-diff: rename node vector/mutex members in CConnman (Sebastian Falbesoner) 574cc4271ab09a4c8f8d076cb1a3a2d5b3924b73 refactor: remove RecursiveMutex cs_totalBytesRecv, use std::atomic instead (Sebastian Falbesoner) Pull request description: This PR is related to #19303 and gets rid of the following RecursiveMutex members in class `CConnman`: * for `cs_totalBytesRecv`, protecting `nTotalBytesRecv`, `std::atomic` is used instead (the member is only increment at one and read at another place, so this is sufficient) * for `m_addr_fetches_mutex`, protecting `m_addr_fetches`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called) * for `cs_vAddedNodes`, protecting `vAddedNodes`, a regular `Mutex` is used instead (there is no chance that within one critical section, another one is called) Additionally, the PR takes the chance to rename all node vector members (vNodes, vAddedNodes) and its corresponding mutexes (cs_vNodes, cs_vAddedNodes) to match the coding guidelines via a scripted-diff. ACKs for top commit: vasild: ACK 3726a4595837b66d37f151faf1cec2796d6b74d7 promag: Code review ACK 3726a4595837b66d37f151faf1cec2796d6b74d7. hebasto: re-ACK 3726a4595837b66d37f151faf1cec2796d6b74d7 Tree-SHA512: 4f5ad41ba2eca397795080988c1739c6abb44c1204dddaa75cc38a396fa821fbe1010694ba7bead1b606beaa677661e66da2a5dca233b2937214f63a54848348
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util/net.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/util/net.h b/src/test/util/net.h
index d89fc34b75..2de6e712a2 100644
--- a/src/test/util/net.h
+++ b/src/test/util/net.h
@@ -25,16 +25,16 @@ struct ConnmanTestMsg : public CConnman {
void AddTestNode(CNode& node)
{
- LOCK(cs_vNodes);
- vNodes.push_back(&node);
+ LOCK(m_nodes_mutex);
+ m_nodes.push_back(&node);
}
void ClearTestNodes()
{
- LOCK(cs_vNodes);
- for (CNode* node : vNodes) {
+ LOCK(m_nodes_mutex);
+ for (CNode* node : m_nodes) {
delete node;
}
- vNodes.clear();
+ m_nodes.clear();
}
void ProcessMessagesOnce(CNode& node) { m_msgproc->ProcessMessages(&node, flagInterruptMsgProc); }