Browse Source

delete messages sent to disconnected session

pull/158/head
orignal 10 years ago
parent
commit
923b64eb48
  1. 11
      NTCPSession.cpp
  2. 13
      SSUSession.cpp

11
NTCPSession.cpp

@ -678,6 +678,11 @@ namespace transport @@ -678,6 +678,11 @@ namespace transport
{
if (msg)
{
if (m_IsTerminated)
{
DeleteI2NPMessage (msg);
return;
}
if (m_IsSending)
m_SendQueue.push_back (msg);
else
@ -692,6 +697,12 @@ namespace transport @@ -692,6 +697,12 @@ namespace transport
void NTCPSession::PostI2NPMessages (std::vector<I2NPMessage *> msgs)
{
if (m_IsTerminated)
{
for (auto it: msgs)
DeleteI2NPMessage (it);
return;
}
if (m_IsSending)
{
for (auto it: msgs)

13
SSUSession.cpp

@ -836,7 +836,12 @@ namespace transport @@ -836,7 +836,12 @@ namespace transport
void SSUSession::PostI2NPMessage (I2NPMessage * msg)
{
if (msg)
{
if (m_State == eSessionStateEstablished)
m_Data.Send (msg);
else
DeleteI2NPMessage (msg);
}
}
void SSUSession::SendI2NPMessages (const std::vector<I2NPMessage *>& msgs)
@ -845,10 +850,18 @@ namespace transport @@ -845,10 +850,18 @@ namespace transport
}
void SSUSession::PostI2NPMessages (std::vector<I2NPMessage *> msgs)
{
if (m_State == eSessionStateEstablished)
{
for (auto it: msgs)
if (it) m_Data.Send (it);
}
else
{
for (auto it: msgs)
DeleteI2NPMessage (it);
}
}
void SSUSession::ProcessData (uint8_t * buf, size_t len)
{

Loading…
Cancel
Save