Browse Source

check if I2NP message to send is not null

pull/1791/head
orignal 2 years ago
parent
commit
9b5a885b3b
  1. 6
      libi2pd/SSU2Session.cpp

6
libi2pd/SSU2Session.cpp

@ -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…
Cancel
Save