From bd6ce7d4dabacd5f9dd5bee524c7042979d75181 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 14 Apr 2017 10:19:26 -0400 Subject: [PATCH] reduced memory usage --- I2NPProtocol.h | 1 + TunnelEndpoint.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/I2NPProtocol.h b/I2NPProtocol.h index 76871114..2f8aac7b 100644 --- a/I2NPProtocol.h +++ b/I2NPProtocol.h @@ -209,6 +209,7 @@ namespace tunnel std::shared_ptr NewI2NPMessage (); std::shared_ptr NewI2NPShortMessage (); + std::shared_ptr NewI2NPTunnelMessage (); std::shared_ptr NewI2NPMessage (size_t len); std::shared_ptr CreateI2NPMessage (I2NPMessageType msgType, const uint8_t * buf, size_t len, uint32_t replyMsgID = 0); diff --git a/TunnelEndpoint.cpp b/TunnelEndpoint.cpp index b4ddc109..dde7d0a6 100644 --- a/TunnelEndpoint.cpp +++ b/TunnelEndpoint.cpp @@ -99,7 +99,7 @@ namespace tunnel if (fragment + size < decrypted + TUNNEL_DATA_ENCRYPTED_SIZE) { // this is not last message. we have to copy it - m.data = NewI2NPShortMessage (); + m.data = NewI2NPTunnelMessage (); m.data->offset += TUNNEL_GATEWAY_HEADER_SIZE; // reserve room for TunnelGateway header m.data->len += TUNNEL_GATEWAY_HEADER_SIZE; *(m.data) = *msg; @@ -154,7 +154,7 @@ namespace tunnel { if (msg.data->len + size > msg.data->maxLen) { - LogPrint (eLogWarning, "TunnelMessage: I2NP message size ", msg.data->maxLen, " is not enough"); + // LogPrint (eLogWarning, "TunnelMessage: I2NP message size ", msg.data->maxLen, " is not enough"); auto newMsg = NewI2NPMessage (); *newMsg = *(msg.data); msg.data = newMsg;