@@ -681,16 +681,16 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
681
681
nRecvBytes += msg_bytes.size ();
682
682
while (msg_bytes.size () > 0 ) {
683
683
// absorb network data
684
- int handled = m_deserializer ->Read (msg_bytes);
684
+ int handled = m_transport ->Read (msg_bytes);
685
685
if (handled < 0 ) {
686
686
// Serious header problem, disconnect from the peer.
687
687
return false ;
688
688
}
689
689
690
- if (m_deserializer ->Complete ()) {
690
+ if (m_transport ->Complete ()) {
691
691
// decompose a transport agnostic CNetMessage from the deserializer
692
692
bool reject_message{false };
693
- CNetMessage msg = m_deserializer ->GetMessage (time , reject_message);
693
+ CNetMessage msg = m_transport ->GetMessage (time , reject_message);
694
694
if (reject_message) {
695
695
// Message deserialization failed. Drop the message but don't disconnect the peer.
696
696
// store the size of the corrupt message
@@ -717,7 +717,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
717
717
return true ;
718
718
}
719
719
720
- int V1TransportDeserializer ::readHeader (Span<const uint8_t > msg_bytes)
720
+ int V1Transport ::readHeader (Span<const uint8_t > msg_bytes)
721
721
{
722
722
// copy data to temporary parsing buffer
723
723
unsigned int nRemaining = CMessageHeader::HEADER_SIZE - nHdrPos;
@@ -757,7 +757,7 @@ int V1TransportDeserializer::readHeader(Span<const uint8_t> msg_bytes)
757
757
return nCopy;
758
758
}
759
759
760
- int V1TransportDeserializer ::readData (Span<const uint8_t > msg_bytes)
760
+ int V1Transport ::readData (Span<const uint8_t > msg_bytes)
761
761
{
762
762
unsigned int nRemaining = hdr.nMessageSize - nDataPos;
763
763
unsigned int nCopy = std::min<unsigned int >(nRemaining, msg_bytes.size ());
@@ -774,15 +774,15 @@ int V1TransportDeserializer::readData(Span<const uint8_t> msg_bytes)
774
774
return nCopy;
775
775
}
776
776
777
- const uint256& V1TransportDeserializer ::GetMessageHash () const
777
+ const uint256& V1Transport ::GetMessageHash () const
778
778
{
779
779
assert (Complete ());
780
780
if (data_hash.IsNull ())
781
781
hasher.Finalize (data_hash);
782
782
return data_hash;
783
783
}
784
784
785
- CNetMessage V1TransportDeserializer ::GetMessage (const std::chrono::microseconds time, bool & reject_message)
785
+ CNetMessage V1Transport ::GetMessage (const std::chrono::microseconds time, bool & reject_message)
786
786
{
787
787
// Initialize out parameter
788
788
reject_message = false ;
@@ -819,7 +819,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
819
819
return msg;
820
820
}
821
821
822
- void V1TransportSerializer ::prepareForTransport (CSerializedNetMsg& msg, std::vector<unsigned char >& header) const
822
+ void V1Transport ::prepareForTransport (CSerializedNetMsg& msg, std::vector<unsigned char >& header) const
823
823
{
824
824
// create dbl-sha256 checksum
825
825
uint256 hash = Hash (msg.data );
@@ -2822,8 +2822,7 @@ CNode::CNode(NodeId idIn,
2822
2822
ConnectionType conn_type_in,
2823
2823
bool inbound_onion,
2824
2824
CNodeOptions&& node_opts)
2825
- : m_deserializer{std::make_unique<V1TransportDeserializer>(V1TransportDeserializer (Params (), idIn, SER_NETWORK, INIT_PROTO_VERSION))},
2826
- m_serializer{std::make_unique<V1TransportSerializer>(V1TransportSerializer ())},
2825
+ : m_transport{std::make_unique<V1Transport>(Params (), idIn, SER_NETWORK, INIT_PROTO_VERSION)},
2827
2826
m_permission_flags{node_opts.permission_flags },
2828
2827
m_sock{sock},
2829
2828
m_connected{GetTime<std::chrono::seconds>()},
@@ -2908,7 +2907,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
2908
2907
2909
2908
// make sure we use the appropriate network transport format
2910
2909
std::vector<unsigned char > serializedHeader;
2911
- pnode->m_serializer ->prepareForTransport (msg, serializedHeader);
2910
+ pnode->m_transport ->prepareForTransport (msg, serializedHeader);
2912
2911
size_t nTotalSize = nMessageSize + serializedHeader.size ();
2913
2912
2914
2913
size_t nBytesSent = 0 ;
0 commit comments