Browse Source

send frame when it exceeds 16K

pull/2014/head
orignal 11 months ago
parent
commit
c158bbe90a
  1. 3
      libi2pd/NTCP2.cpp
  2. 3
      libi2pd/NTCP2.h

3
libi2pd/NTCP2.cpp

@ -1152,10 +1152,13 @@ namespace transport
msgs.push_back (msg); msgs.push_back (msg);
s += (len + 3); s += (len + 3);
m_SendQueue.pop_front (); m_SendQueue.pop_front ();
if (s >= NTCP2_SEND_AFTER_FRAME_SIZE)
break; // send frame right a way
} }
else if (len + 3 > NTCP2_UNENCRYPTED_FRAME_MAX_SIZE) else if (len + 3 > NTCP2_UNENCRYPTED_FRAME_MAX_SIZE)
{ {
LogPrint (eLogError, "NTCP2: I2NP message of size ", len, " can't be sent. Dropped"); LogPrint (eLogError, "NTCP2: I2NP message of size ", len, " can't be sent. Dropped");
msg->Drop ();
m_SendQueue.pop_front (); m_SendQueue.pop_front ();
} }
else else

3
libi2pd/NTCP2.h

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2022, The PurpleI2P Project * Copyright (c) 2013-2024, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -28,6 +28,7 @@ namespace transport
{ {
const size_t NTCP2_UNENCRYPTED_FRAME_MAX_SIZE = 65519; const size_t NTCP2_UNENCRYPTED_FRAME_MAX_SIZE = 65519;
const size_t NTCP2_SEND_AFTER_FRAME_SIZE = 16386; // send frame when exceeds this size
const size_t NTCP2_SESSION_REQUEST_MAX_SIZE = 287; const size_t NTCP2_SESSION_REQUEST_MAX_SIZE = 287;
const size_t NTCP2_SESSION_CREATED_MAX_SIZE = 287; const size_t NTCP2_SESSION_CREATED_MAX_SIZE = 287;
const int NTCP2_MAX_PADDING_RATIO = 6; // in % const int NTCP2_MAX_PADDING_RATIO = 6; // in %

Loading…
Cancel
Save