aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2019-06-13 11:07:50 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2019-10-18 08:56:08 +0200
commit1a5c656c3169ba525f84145d19ce8c64f2cf1efb (patch)
treeca8d33a4009c55ce5145482e4af6788966a1fc2f /src/net.cpp
parent6294ecdb8bb4eb7049a18c721ee8cb4a53d80a06 (diff)
Remove transport protocol knowhow from CNetMessage / net processing
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index bd183ce52b..ee9d71786a 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -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);