aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-08-28 19:51:08 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-11-24 19:19:42 +0100
commit574cc4271ab09a4c8f8d076cb1a3a2d5b3924b73 (patch)
tree58f1db991f8c3d93be532636288d832e75adeefc /src/net.cpp
parent64059b78f59e45cc4200ca76d0af8c6dff8a20d4 (diff)
downloadbitcoin-574cc4271ab09a4c8f8d076cb1a3a2d5b3924b73.tar.xz
refactor: remove RecursiveMutex cs_totalBytesRecv, use std::atomic instead
The RecursiveMutex cs_totalBytesRecv is only used at two places: in CConnman::RecordBytesRecv() to increment the nTotalBytesRecv member, and in CConnman::GetTotalBytesRecv() to read it. For this simple use-case, we can make the member std::atomic instead to achieve the same result.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 1b6d16ad9b..5406e7e49d 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2879,7 +2879,6 @@ bool CConnman::DisconnectNode(NodeId id)
void CConnman::RecordBytesRecv(uint64_t bytes)
{
- LOCK(cs_totalBytesRecv);
nTotalBytesRecv += bytes;
}
@@ -2956,7 +2955,6 @@ uint64_t CConnman::GetOutboundTargetBytesLeft() const
uint64_t CConnman::GetTotalBytesRecv() const
{
- LOCK(cs_totalBytesRecv);
return nTotalBytesRecv;
}