terminate session in separate task

This commit is contained in:
orignal 2022-07-26 19:56:30 -04:00
parent 6b513a0f95
commit 4b1f5c9c9b
3 changed files with 11 additions and 11 deletions

View file

@ -403,7 +403,7 @@ namespace transport
case eSSU2SessionStateSessionCreatedSent:
if (!m_LastSession->ProcessSessionConfirmed (buf, len))
{
m_LastSession->Terminate ();
m_LastSession->Done ();
m_LastSession = nullptr;
}
break;
@ -416,7 +416,7 @@ namespace transport
{
LogPrint (eLogWarning, "SSU2: HolePunch endpoint ", senderEndpoint,
" doesn't match RelayResponse ", m_LastSession->GetRemoteEndpoint ());
m_LastSession->Terminate ();
m_LastSession->Done ();
m_LastSession = nullptr;
}
break;
@ -678,13 +678,13 @@ namespace transport
{
auto state = it.second->GetState ();
if (state == eSSU2SessionStateTerminated || state == eSSU2SessionStateClosing)
GetService ().post (std::bind (&SSU2Session::Terminate, it.second));
it.second->Done ();
else if (it.second->IsTerminationTimeoutExpired (ts))
{
if (it.second->IsEstablished ())
it.second->RequestTermination (eSSU2TerminationReasonIdleTimeout);
else
GetService ().post (std::bind (&SSU2Session::Terminate, it.second));
it.second->Done ();
}
else
it.second->CleanUp (ts);