cleanup messages to send if session was terminated

This commit is contained in:
orignal 2024-10-28 21:34:33 -04:00
parent 361f364966
commit f04048717d
2 changed files with 10 additions and 2 deletions

View File

@ -1301,7 +1301,11 @@ namespace transport
void NTCP2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs)
{
if (m_IsTerminated || msgs.empty ()) return;
if (m_IsTerminated || msgs.empty ())
{
msgs.clear ();
return;
}
bool empty = false;
{
std::lock_guard<std::mutex> l(m_IntermediateQueueMutex);

View File

@ -376,7 +376,11 @@ namespace transport
void SSU2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs)
{
if (m_State == eSSU2SessionStateTerminated || msgs.empty ()) return;
if (m_State == eSSU2SessionStateTerminated || msgs.empty ())
{
msgs.clear ();
return;
}
bool empty = false;
{
std::lock_guard<std::mutex> l(m_IntermediateQueueMutex);