diff --git a/src/net.h b/src/net.h --- a/src/net.h +++ b/src/net.h @@ -128,7 +128,7 @@ CSerializedNetMsg &operator=(const CSerializedNetMsg &) = delete; std::vector data; - std::string command; + std::string m_type; }; namespace { diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -757,7 +757,7 @@ uint256 hash = Hash(msg.data.begin(), msg.data.end()); // create header - CMessageHeader hdr(config.GetChainParams().NetMagic(), msg.command.c_str(), + CMessageHeader hdr(config.GetChainParams().NetMagic(), msg.m_type.c_str(), msg.data.size()); memcpy(hdr.pchChecksum, hash.begin(), CMessageHeader::CHECKSUM_SIZE); @@ -2966,7 +2966,7 @@ void CConnman::PushMessage(CNode *pnode, CSerializedNetMsg &&msg) { size_t nMessageSize = msg.data.size(); LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", - SanitizeString(msg.command), nMessageSize, pnode->GetId()); + SanitizeString(msg.m_type), nMessageSize, pnode->GetId()); // make sure we use the appropriate network transport format std::vector serializedHeader; @@ -2978,8 +2978,8 @@ LOCK(pnode->cs_vSend); bool optimisticSend(pnode->vSendMsg.empty()); - // log total amount of bytes per command - pnode->mapSendBytesPerMsgCmd[msg.command] += nTotalSize; + // log total amount of bytes per message type + pnode->mapSendBytesPerMsgCmd[msg.m_type] += nTotalSize; pnode->nSendSize += nTotalSize; if (pnode->nSendSize > nSendBufferMaxSize) { diff --git a/src/netmessagemaker.h b/src/netmessagemaker.h --- a/src/netmessagemaker.h +++ b/src/netmessagemaker.h @@ -14,18 +14,18 @@ explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn) {} template - CSerializedNetMsg Make(int nFlags, std::string sCommand, + CSerializedNetMsg Make(int nFlags, std::string msg_type, Args &&... args) const { CSerializedNetMsg msg; - msg.command = std::move(sCommand); + msg.m_type = std::move(msg_type); CVectorWriter{SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward(args)...}; return msg; } template - CSerializedNetMsg Make(std::string sCommand, Args &&... args) const { - return Make(0, std::move(sCommand), std::forward(args)...); + CSerializedNetMsg Make(std::string msg_type, Args &&... args) const { + return Make(0, std::move(msg_type), std::forward(args)...); } private: