@@ -53,7 +53,7 @@ static const unsigned int MAX_LOCATOR_SZ = 101;
53
53
static const unsigned int MAX_ADDR_TO_SEND = 1000 ;
54
54
/* * Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
55
55
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000 ;
56
- /* * Maximum length of strSubVer in `version` message */
56
+ /* * Maximum length of the user agent string in `version` message */
57
57
static const unsigned int MAX_SUBVERSION_LENGTH = 256 ;
58
58
/* * Maximum number of automatic outgoing nodes */
59
59
static const int MAX_OUTBOUND_CONNECTIONS = 8 ;
@@ -650,12 +650,12 @@ class CNode
650
650
// Bind address of our side of the connection
651
651
const CAddress addrBind;
652
652
std::atomic<int > nVersion{0 };
653
- // strSubVer is whatever byte array we read from the wire. However, this field is intended
654
- // to be printed out, displayed to humans in various forms and so on. So we sanitize it and
655
- // store the sanitized version in cleanSubVer. The original should be used when dealing with
656
- // the network or wire types and the cleaned string used when displayed or logged .
657
- std::string strSubVer GUARDED_BY (cs_SubVer), cleanSubVer GUARDED_BY(cs_SubVer);
658
- CCriticalSection cs_SubVer; // used for both cleanSubVer and strSubVer
653
+ RecursiveMutex cs_SubVer;
654
+ /* *
655
+ * cleanSubVer is a sanitized string of the user agent byte array we read
656
+ * from the wire. This cleaned string can safely be logged or displayed .
657
+ */
658
+ std::string cleanSubVer GUARDED_BY (cs_SubVer){};
659
659
bool m_prefer_evict{false }; // This peer is preferred for eviction.
660
660
bool fWhitelisted {false }; // This peer can bypass DoS banning.
661
661
bool fFeeler {false }; // If true this node is being used as a short lived feeler.
0 commit comments