mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-16 00:12:43 +00:00
correct max MTU size
This commit is contained in:
parent
3539ee9be6
commit
d7d74666b2
@ -245,7 +245,7 @@ namespace transport
|
||||
m_SendQueue.pop_front ();
|
||||
packet->payloadSize += CreateI2NPBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - packet->payloadSize, std::move (msg));
|
||||
}
|
||||
else if (len > SSU2_MAX_PAYLOAD_SIZE - 32) // message too long
|
||||
else if (len > SSU2_MAX_PAYLOAD_SIZE) // message too long
|
||||
{
|
||||
m_SendQueue.pop_front ();
|
||||
SendFragmentedMessage (msg);
|
||||
@ -281,11 +281,11 @@ namespace transport
|
||||
memcpy (&msgID, msg->GetHeader () + I2NP_HEADER_MSGID_OFFSET, 4);
|
||||
auto nextResend = i2p::util::GetSecondsSinceEpoch () + SSU2_RESEND_INTERVAL;
|
||||
auto packet = std::make_shared<SentPacket>();
|
||||
packet->payloadSize += CreateAckBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - packet->payloadSize);
|
||||
auto size = CreateFirstFragmentBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - 32 - packet->payloadSize, msg);
|
||||
packet->payloadSize = CreateAckBlock (packet->payload, SSU2_MAX_PAYLOAD_SIZE);
|
||||
auto size = CreateFirstFragmentBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - 16 - packet->payloadSize, msg);
|
||||
if (!size) return;
|
||||
packet->payloadSize += size;
|
||||
packet->payloadSize += CreatePaddingBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - packet->payloadSize);
|
||||
packet->payloadSize += CreatePaddingBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - 16 - packet->payloadSize);
|
||||
uint32_t firstPacketNum = SendData (packet->payload, packet->payloadSize);
|
||||
packet->nextResendTime = nextResend;
|
||||
m_SentPackets.emplace (firstPacketNum, packet);
|
||||
@ -293,8 +293,8 @@ namespace transport
|
||||
while (msg->offset < msg->len)
|
||||
{
|
||||
packet = std::make_shared<SentPacket>();
|
||||
packet->payloadSize += CreateFollowOnFragmentBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - packet->payloadSize - 16, msg, fragmentNum, msgID);
|
||||
packet->payloadSize += CreatePaddingBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - packet->payloadSize);
|
||||
packet->payloadSize = CreateFollowOnFragmentBlock (packet->payload, SSU2_MAX_PAYLOAD_SIZE - 16, msg, fragmentNum, msgID);
|
||||
packet->payloadSize += CreatePaddingBlock (packet->payload + packet->payloadSize, SSU2_MAX_PAYLOAD_SIZE - 16 - packet->payloadSize);
|
||||
uint32_t followonPacketNum = SendData (packet->payload, packet->payloadSize);
|
||||
packet->nextResendTime = nextResend;
|
||||
m_SentPackets.emplace (followonPacketNum, packet);
|
||||
|
@ -30,7 +30,7 @@ namespace transport
|
||||
const int SSU2_TOKEN_EXPIRATION_THRESHOLD = 2; // in seconds
|
||||
const int SSU2_RELAY_NONCE_EXPIRATION_TIMEOUT = 10; // in seconds
|
||||
const int SSU2_PEER_TEST_EXPIRATION_TIMEOUT = 60; // 60 seconds
|
||||
const size_t SSU2_MTU = 1488;
|
||||
const size_t SSU2_MTU = 1440; // TODO: should be 1456 for ipv4
|
||||
const size_t SSU2_MAX_PAYLOAD_SIZE = SSU2_MTU - 32;
|
||||
const int SSU2_HANDSHAKE_RESEND_INTERVAL = 1; // in seconds
|
||||
const int SSU2_RESEND_INTERVAL = 3; // in seconds
|
||||
|
Loading…
Reference in New Issue
Block a user