Skip to content

Commit 2f7a138

Browse files
committed
merge bitcoin#24079: replace RecursiveMutex cs_SubVer with Mutex (and rename)
1 parent 23b152c commit 2f7a138

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap)
648648
X(m_addr_name);
649649
X(nVersion);
650650
{
651-
LOCK(cs_SubVer);
651+
LOCK(m_subver_mutex);
652652
X(cleanSubVer);
653653
}
654654
stats.fInbound = IsInboundConn();

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,12 @@ class CNode
476476
const bool m_inbound_onion;
477477
std::atomic<int> nNumWarningsSkipped{0};
478478
std::atomic<int> nVersion{0};
479+
Mutex m_subver_mutex;
479480
/**
480481
* cleanSubVer is a sanitized string of the user agent byte array we read
481482
* from the wire. This cleaned string can safely be logged or displayed.
482483
*/
483-
std::string cleanSubVer GUARDED_BY(cs_SubVer){};
484-
RecursiveMutex cs_SubVer; // used for both cleanSubVer and strSubVer
484+
std::string cleanSubVer GUARDED_BY(m_subver_mutex){};
485485
bool m_prefer_evict{false}; // This peer is preferred for eviction.
486486
bool HasPermission(NetPermissionFlags permission) const {
487487
return NetPermissions::HasFlag(m_permissionFlags, permission);

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ void PeerManagerImpl::ProcessMessage(
33573357
pfrom.nServices = nServices;
33583358
pfrom.SetAddrLocal(addrMe);
33593359
{
3360-
LOCK(pfrom.cs_SubVer);
3360+
LOCK(pfrom.m_subver_mutex);
33613361
pfrom.cleanSubVer = cleanSubVer;
33623362
}
33633363
peer->m_starting_height = starting_height;

0 commit comments

Comments
 (0)