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;