Browse Source

SSU packet size

pull/97/head
orignal 10 years ago
parent
commit
c0a70faab3
  1. 2
      SSUData.cpp
  2. 5
      SSUData.h

2
SSUData.cpp

@ -245,7 +245,7 @@ namespace ssu
sentMessage->numResends = 0; sentMessage->numResends = 0;
auto& fragments = sentMessage->fragments; auto& fragments = sentMessage->fragments;
msgID = htobe32 (msgID); 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 (); size_t len = msg->GetLength ();
uint8_t * msgBuf = msg->GetSSUHeader (); uint8_t * msgBuf = msg->GetSSUHeader ();

5
SSUData.h

@ -14,7 +14,8 @@ namespace i2p
namespace ssu 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 RESEND_INTERVAL = 3; // in seconds
const int MAX_NUM_RESENDS = 5; const int MAX_NUM_RESENDS = 5;
// data flags // data flags
@ -30,7 +31,7 @@ namespace ssu
int fragmentNum; int fragmentNum;
size_t len; size_t len;
bool isLast; bool isLast;
uint8_t buf[SSU_MTU + 18]; uint8_t buf[SSU_PACKET_SIZE + 18];
Fragment () = default; Fragment () = default;
Fragment (int n, const uint8_t * b, int l, bool last): Fragment (int n, const uint8_t * b, int l, bool last):

Loading…
Cancel
Save