merge bitcoin#24079: replace RecursiveMutex cs_SubVer with Mutex (and rename)

This commit is contained in:
Kittywhiskers Van Gogh 2024-04-29 17:08:32 +00:00
parent 23b152cd37
commit 2f7a138452
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 4 additions and 4 deletions

View File

@ -648,7 +648,7 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap)
X(m_addr_name);
X(nVersion);
{
LOCK(cs_SubVer);
LOCK(m_subver_mutex);
X(cleanSubVer);
}
stats.fInbound = IsInboundConn();

View File

@ -476,12 +476,12 @@ public:
const bool m_inbound_onion;
std::atomic<int> nNumWarningsSkipped{0};
std::atomic<int> 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);

View File

@ -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;