Browse Source

cleanup messages to send if session was terminated

pull/2121/head
orignal 3 weeks ago
parent
commit
f04048717d
  1. 6
      libi2pd/NTCP2.cpp
  2. 6
      libi2pd/SSU2Session.cpp

6
libi2pd/NTCP2.cpp

@ -1301,7 +1301,11 @@ namespace transport
void NTCP2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs) 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; bool empty = false;
{ {
std::lock_guard<std::mutex> l(m_IntermediateQueueMutex); std::lock_guard<std::mutex> l(m_IntermediateQueueMutex);

6
libi2pd/SSU2Session.cpp

@ -376,7 +376,11 @@ namespace transport
void SSU2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs) 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; bool empty = false;
{ {
std::lock_guard<std::mutex> l(m_IntermediateQueueMutex); std::lock_guard<std::mutex> l(m_IntermediateQueueMutex);

Loading…
Cancel
Save