mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
net: Remove unused unsanitized user agent string CNode::strSubVer
This commit is contained in:
parent
7b13c64645
commit
fa8548c5d1
@ -2627,7 +2627,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
|||||||
{
|
{
|
||||||
hSocket = hSocketIn;
|
hSocket = hSocketIn;
|
||||||
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
|
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
|
||||||
strSubVer = "";
|
|
||||||
hashContinue = uint256();
|
hashContinue = uint256();
|
||||||
filterInventoryKnown.reset();
|
filterInventoryKnown.reset();
|
||||||
pfilter = MakeUnique<CBloomFilter>();
|
pfilter = MakeUnique<CBloomFilter>();
|
||||||
|
14
src/net.h
14
src/net.h
@ -53,7 +53,7 @@ static const unsigned int MAX_LOCATOR_SZ = 101;
|
|||||||
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
||||||
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
|
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
|
||||||
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;
|
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000;
|
||||||
/** Maximum length of strSubVer in `version` message */
|
/** Maximum length of the user agent string in `version` message */
|
||||||
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
|
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
|
||||||
/** Maximum number of automatic outgoing nodes */
|
/** Maximum number of automatic outgoing nodes */
|
||||||
static const int MAX_OUTBOUND_CONNECTIONS = 8;
|
static const int MAX_OUTBOUND_CONNECTIONS = 8;
|
||||||
@ -650,12 +650,12 @@ public:
|
|||||||
// Bind address of our side of the connection
|
// Bind address of our side of the connection
|
||||||
const CAddress addrBind;
|
const CAddress addrBind;
|
||||||
std::atomic<int> nVersion{0};
|
std::atomic<int> nVersion{0};
|
||||||
// strSubVer is whatever byte array we read from the wire. However, this field is intended
|
RecursiveMutex cs_SubVer;
|
||||||
// to be printed out, displayed to humans in various forms and so on. So we sanitize it and
|
/**
|
||||||
// store the sanitized version in cleanSubVer. The original should be used when dealing with
|
* cleanSubVer is a sanitized string of the user agent byte array we read
|
||||||
// the network or wire types and the cleaned string used when displayed or logged.
|
* from the wire. This cleaned string can safely be logged or displayed.
|
||||||
std::string strSubVer GUARDED_BY(cs_SubVer), cleanSubVer GUARDED_BY(cs_SubVer);
|
*/
|
||||||
CCriticalSection cs_SubVer; // used for both cleanSubVer and strSubVer
|
std::string cleanSubVer GUARDED_BY(cs_SubVer){};
|
||||||
bool m_prefer_evict{false}; // This peer is preferred for eviction.
|
bool m_prefer_evict{false}; // This peer is preferred for eviction.
|
||||||
bool fWhitelisted{false}; // This peer can bypass DoS banning.
|
bool fWhitelisted{false}; // This peer can bypass DoS banning.
|
||||||
bool fFeeler{false}; // If true this node is being used as a short lived feeler.
|
bool fFeeler{false}; // If true this node is being used as a short lived feeler.
|
||||||
|
@ -1782,7 +1782,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
ServiceFlags nServices;
|
ServiceFlags nServices;
|
||||||
int nVersion;
|
int nVersion;
|
||||||
int nSendVersion;
|
int nSendVersion;
|
||||||
std::string strSubVer;
|
|
||||||
std::string cleanSubVer;
|
std::string cleanSubVer;
|
||||||
int nStartingHeight = -1;
|
int nStartingHeight = -1;
|
||||||
bool fRelay = true;
|
bool fRelay = true;
|
||||||
@ -1819,6 +1818,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
if (!vRecv.empty())
|
if (!vRecv.empty())
|
||||||
vRecv >> addrFrom >> nNonce;
|
vRecv >> addrFrom >> nNonce;
|
||||||
if (!vRecv.empty()) {
|
if (!vRecv.empty()) {
|
||||||
|
std::string strSubVer;
|
||||||
vRecv >> LIMITED_STRING(strSubVer, MAX_SUBVERSION_LENGTH);
|
vRecv >> LIMITED_STRING(strSubVer, MAX_SUBVERSION_LENGTH);
|
||||||
cleanSubVer = SanitizeString(strSubVer);
|
cleanSubVer = SanitizeString(strSubVer);
|
||||||
}
|
}
|
||||||
@ -1850,7 +1850,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
pfrom->SetAddrLocal(addrMe);
|
pfrom->SetAddrLocal(addrMe);
|
||||||
{
|
{
|
||||||
LOCK(pfrom->cs_SubVer);
|
LOCK(pfrom->cs_SubVer);
|
||||||
pfrom->strSubVer = strSubVer;
|
|
||||||
pfrom->cleanSubVer = cleanSubVer;
|
pfrom->cleanSubVer = cleanSubVer;
|
||||||
}
|
}
|
||||||
pfrom->nStartingHeight = nStartingHeight;
|
pfrom->nStartingHeight = nStartingHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user