mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-15 18:10:26 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user