mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-20 22:04:19 +02:00
refactor: rename command -> message type in comments in the src/net* files
Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
This commit is contained in:
parent
2b09593bdd
commit
e71c51b27d
@ -657,8 +657,8 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store received bytes per message command
|
// Store received bytes per message type.
|
||||||
// to prevent a memory DOS, only allow valid commands
|
// To prevent a memory DOS, only allow known message types.
|
||||||
auto i = mapRecvBytesPerMsgType.find(msg.m_type);
|
auto i = mapRecvBytesPerMsgType.find(msg.m_type);
|
||||||
if (i == mapRecvBytesPerMsgType.end()) {
|
if (i == mapRecvBytesPerMsgType.end()) {
|
||||||
i = mapRecvBytesPerMsgType.find(NET_MESSAGE_TYPE_OTHER);
|
i = mapRecvBytesPerMsgType.find(NET_MESSAGE_TYPE_OTHER);
|
||||||
@ -748,7 +748,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
|||||||
// decompose a single CNetMessage from the TransportDeserializer
|
// decompose a single CNetMessage from the TransportDeserializer
|
||||||
CNetMessage msg(std::move(vRecv));
|
CNetMessage msg(std::move(vRecv));
|
||||||
|
|
||||||
// store command string, time, and sizes
|
// store message type string, time, and sizes
|
||||||
msg.m_type = hdr.GetCommand();
|
msg.m_type = hdr.GetCommand();
|
||||||
msg.m_time = time;
|
msg.m_time = time;
|
||||||
msg.m_message_size = hdr.nMessageSize;
|
msg.m_message_size = hdr.nMessageSize;
|
||||||
@ -759,7 +759,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
|||||||
// We just received a message off the wire, harvest entropy from the time (and the message checksum)
|
// We just received a message off the wire, harvest entropy from the time (and the message checksum)
|
||||||
RandAddEvent(ReadLE32(hash.begin()));
|
RandAddEvent(ReadLE32(hash.begin()));
|
||||||
|
|
||||||
// Check checksum and header command string
|
// Check checksum and header message type string
|
||||||
if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
|
if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
|
||||||
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
|
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
|
||||||
SanitizeString(msg.m_type), msg.m_message_size,
|
SanitizeString(msg.m_type), msg.m_message_size,
|
||||||
|
@ -234,7 +234,7 @@ extern Mutex g_maplocalhost_mutex;
|
|||||||
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex);
|
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex);
|
||||||
|
|
||||||
extern const std::string NET_MESSAGE_TYPE_OTHER;
|
extern const std::string NET_MESSAGE_TYPE_OTHER;
|
||||||
typedef std::map<std::string, uint64_t> mapMsgTypeSize; //command, total bytes
|
using mapMsgTypeSize = std::map</* message type */ std::string, /* total bytes */ uint64_t>;
|
||||||
|
|
||||||
class CNodeStats
|
class CNodeStats
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ public:
|
|||||||
|
|
||||||
/** The TransportDeserializer takes care of holding and deserializing the
|
/** The TransportDeserializer takes care of holding and deserializing the
|
||||||
* network receive buffer. It can deserialize the network buffer into a
|
* network receive buffer. It can deserialize the network buffer into a
|
||||||
* transport protocol agnostic CNetMessage (command & payload)
|
* transport protocol agnostic CNetMessage (message type & payload)
|
||||||
*/
|
*/
|
||||||
class TransportDeserializer {
|
class TransportDeserializer {
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user