mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-25 06:55:32 +01:00
Remove transport protocol knowhow from CNetMessage / net processing
This commit is contained in:
@@ -601,7 +601,7 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete
|
||||
if (i == mapRecvBytesPerMsgCmd.end())
|
||||
i = mapRecvBytesPerMsgCmd.find(NET_MESSAGE_COMMAND_OTHER);
|
||||
assert(i != mapRecvBytesPerMsgCmd.end());
|
||||
i->second += m_deserializer->hdr.nMessageSize + CMessageHeader::HEADER_SIZE;
|
||||
i->second += msg.m_raw_message_size;
|
||||
|
||||
// push the message to the process queue,
|
||||
vRecvMsg.push_back(std::move(msg));
|
||||
@@ -707,6 +707,7 @@ CNetMessage TransportDeserializer::GetMessage(const CMessageHeader::MessageStart
|
||||
// store command string, payload size
|
||||
msg.m_command = hdr.GetCommand();
|
||||
msg.m_message_size = hdr.nMessageSize;
|
||||
msg.m_raw_message_size = hdr.nMessageSize + CMessageHeader::HEADER_SIZE;
|
||||
|
||||
msg.m_valid_checksum = (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) == 0);
|
||||
if (!msg.m_valid_checksum) {
|
||||
@@ -1377,7 +1378,7 @@ void CConnman::SocketHandler()
|
||||
for (; it != pnode->vRecvMsg.end(); ++it) {
|
||||
// vRecvMsg contains only completed CNetMessage
|
||||
// the single possible partially deserialized message are held by TransportDeserializer
|
||||
nSizeAdded += it->m_recv.size() + CMessageHeader::HEADER_SIZE;
|
||||
nSizeAdded += it->m_raw_message_size;
|
||||
}
|
||||
{
|
||||
LOCK(pnode->cs_vProcessMsg);
|
||||
|
||||
Reference in New Issue
Block a user