From c0a70faab360dc96bef0e6d64298f63f3f0a81b2 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 14 Sep 2014 12:39:56 -0400 Subject: [PATCH] SSU packet size --- SSUData.cpp | 2 +- SSUData.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SSUData.cpp b/SSUData.cpp index 0810cf78..62bff62e 100644 --- a/SSUData.cpp +++ b/SSUData.cpp @@ -245,7 +245,7 @@ namespace ssu sentMessage->numResends = 0; auto& fragments = sentMessage->fragments; msgID = htobe32 (msgID); - size_t payloadSize = SSU_MTU - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3) + size_t payloadSize = SSU_PACKET_SIZE - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3) size_t len = msg->GetLength (); uint8_t * msgBuf = msg->GetSSUHeader (); diff --git a/SSUData.h b/SSUData.h index b029d642..0dddbaa8 100644 --- a/SSUData.h +++ b/SSUData.h @@ -14,7 +14,8 @@ namespace i2p namespace ssu { - const size_t SSU_MTU = 1472; // 1484; + const size_t SSU_MTU = 1484; + const size_t SSU_PACKET_SIZE = SSU_MTU - 20 - 8; // 20 - IPv4 header, 8 - UDP const int RESEND_INTERVAL = 3; // in seconds const int MAX_NUM_RESENDS = 5; // data flags @@ -30,7 +31,7 @@ namespace ssu int fragmentNum; size_t len; bool isLast; - uint8_t buf[SSU_MTU + 18]; + uint8_t buf[SSU_PACKET_SIZE + 18]; Fragment () = default; Fragment (int n, const uint8_t * b, int l, bool last):