From 2f7a138452c5813766fc2e067e4b1ffbc5d500dc Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:08:32 +0000 Subject: [PATCH] merge bitcoin#24079: replace RecursiveMutex cs_SubVer with Mutex (and rename) --- src/net.cpp | 2 +- src/net.h | 4 ++-- src/net_processing.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 409b50b5a6..9b57c8ffab 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -648,7 +648,7 @@ void CNode::copyStats(CNodeStats &stats, const std::vector &m_asmap) X(m_addr_name); X(nVersion); { - LOCK(cs_SubVer); + LOCK(m_subver_mutex); X(cleanSubVer); } stats.fInbound = IsInboundConn(); diff --git a/src/net.h b/src/net.h index 7b5743fb27..fdf49e060e 100644 --- a/src/net.h +++ b/src/net.h @@ -476,12 +476,12 @@ public: const bool m_inbound_onion; std::atomic nNumWarningsSkipped{0}; std::atomic nVersion{0}; + Mutex m_subver_mutex; /** * cleanSubVer is a sanitized string of the user agent byte array we read * from the wire. This cleaned string can safely be logged or displayed. */ - std::string cleanSubVer GUARDED_BY(cs_SubVer){}; - RecursiveMutex cs_SubVer; // used for both cleanSubVer and strSubVer + std::string cleanSubVer GUARDED_BY(m_subver_mutex){}; bool m_prefer_evict{false}; // This peer is preferred for eviction. bool HasPermission(NetPermissionFlags permission) const { return NetPermissions::HasFlag(m_permissionFlags, permission); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 7f79ab4892..72ef8b3ea2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3357,7 +3357,7 @@ void PeerManagerImpl::ProcessMessage( pfrom.nServices = nServices; pfrom.SetAddrLocal(addrMe); { - LOCK(pfrom.cs_SubVer); + LOCK(pfrom.m_subver_mutex); pfrom.cleanSubVer = cleanSubVer; } peer->m_starting_height = starting_height;