mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
check if I2NP message to send is not null
This commit is contained in:
parent
f32b288785
commit
9b5a885b3b
|
@ -310,6 +310,11 @@ namespace transport
|
||||||
while (!m_SendQueue.empty () && m_SentPackets.size () <= m_WindowSize)
|
while (!m_SendQueue.empty () && m_SentPackets.size () <= m_WindowSize)
|
||||||
{
|
{
|
||||||
auto msg = m_SendQueue.front ();
|
auto msg = m_SendQueue.front ();
|
||||||
|
if (!msg)
|
||||||
|
{
|
||||||
|
m_SendQueue.pop_front ();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
size_t len = msg->GetNTCP2Length () + 3;
|
size_t len = msg->GetNTCP2Length () + 3;
|
||||||
if (len > m_MaxPayloadSize) // message too long
|
if (len > m_MaxPayloadSize) // message too long
|
||||||
{
|
{
|
||||||
|
@ -376,6 +381,7 @@ namespace transport
|
||||||
|
|
||||||
bool SSU2Session::SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg)
|
bool SSU2Session::SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg)
|
||||||
{
|
{
|
||||||
|
if (!msg) return false;
|
||||||
size_t lastFragmentSize = (msg->GetNTCP2Length () + 3 - m_MaxPayloadSize) % (m_MaxPayloadSize - 8);
|
size_t lastFragmentSize = (msg->GetNTCP2Length () + 3 - m_MaxPayloadSize) % (m_MaxPayloadSize - 8);
|
||||||
size_t extraSize = m_MaxPayloadSize - lastFragmentSize;
|
size_t extraSize = m_MaxPayloadSize - lastFragmentSize;
|
||||||
bool ackBlockSent = false;
|
bool ackBlockSent = false;
|
||||||
|
|
Loading…
Reference in a new issue