mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-09 20:51:04 +00:00
send outstanding data on close
This commit is contained in:
parent
756e15fe19
commit
c0043e5098
@ -201,9 +201,9 @@ namespace stream
|
||||
if (flags & PACKET_FLAG_CLOSE)
|
||||
{
|
||||
LogPrint (eLogInfo, "Closed");
|
||||
Close ();
|
||||
m_IsOpen = false;
|
||||
m_IsReset = true;
|
||||
Close ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,6 +261,8 @@ namespace stream
|
||||
m_ResendTimer.cancel ();
|
||||
if (acknowledged)
|
||||
SendBuffer ();
|
||||
if (!m_IsOpen)
|
||||
Close (); // all outgoing messages have been sent
|
||||
}
|
||||
|
||||
size_t Stream::Send (const uint8_t * buf, size_t len)
|
||||
@ -463,8 +465,15 @@ namespace stream
|
||||
m_Service.post (std::bind (&Stream::SendPacket, shared_from_this (), p));
|
||||
LogPrint ("FIN sent");
|
||||
}
|
||||
m_ReceiveTimer.cancel ();
|
||||
m_LocalDestination.DeleteStream (shared_from_this ());
|
||||
if (m_IsReset || (m_SentPackets.empty () && m_SendBuffer.eof ()))
|
||||
{
|
||||
// no more outgoing data or closed by peer
|
||||
m_ReceiveTimer.cancel ();
|
||||
m_LocalDestination.DeleteStream (shared_from_this ());
|
||||
}
|
||||
else
|
||||
LogPrint (eLogInfo, "Trying to send stream data before closing");
|
||||
|
||||
}
|
||||
|
||||
size_t Stream::ConcatenatePackets (uint8_t * buf, size_t len)
|
||||
@ -584,7 +593,7 @@ namespace stream
|
||||
LogPrint (eLogWarning, "Packet ", it->GetSeqn (), " was not ACKed after ", MAX_NUM_RESEND_ATTEMPTS, " attempts. Terminate");
|
||||
m_IsOpen = false;
|
||||
m_IsReset = true;
|
||||
m_ReceiveTimer.cancel ();
|
||||
Close ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user