|
|
@ -239,6 +239,8 @@ namespace transport |
|
|
|
auto ident = it->second->GetRemoteIdentity (); |
|
|
|
auto ident = it->second->GetRemoteIdentity (); |
|
|
|
if (ident) |
|
|
|
if (ident) |
|
|
|
m_SessionsByRouterHash.erase (ident->GetIdentHash ()); |
|
|
|
m_SessionsByRouterHash.erase (ident->GetIdentHash ()); |
|
|
|
|
|
|
|
if (m_LastSession == it->second) |
|
|
|
|
|
|
|
m_LastSession = nullptr; |
|
|
|
m_Sessions.erase (it); |
|
|
|
m_Sessions.erase (it); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -385,6 +387,9 @@ namespace transport |
|
|
|
m_LastSession->SetRemoteEndpoint (senderEndpoint); |
|
|
|
m_LastSession->SetRemoteEndpoint (senderEndpoint); |
|
|
|
m_LastSession->ProcessPeerTest (buf, len); |
|
|
|
m_LastSession->ProcessPeerTest (buf, len); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case eSSU2SessionStateClosing: |
|
|
|
|
|
|
|
m_LastSession->RequestTermination (); // send termination again
|
|
|
|
|
|
|
|
break; |
|
|
|
case eSSU2SessionStateTerminated: |
|
|
|
case eSSU2SessionStateTerminated: |
|
|
|
m_LastSession = nullptr; |
|
|
|
m_LastSession = nullptr; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -617,22 +622,20 @@ namespace transport |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (auto it = m_Sessions.begin (); it != m_Sessions.end ();) |
|
|
|
for (auto it: m_Sessions) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it->second->GetState () == eSSU2SessionStateTerminated || |
|
|
|
auto state = it.second->GetState (); |
|
|
|
it->second->IsTerminationTimeoutExpired (ts)) |
|
|
|
if (state == eSSU2SessionStateTerminated || state == eSSU2SessionStateClosing) |
|
|
|
|
|
|
|
GetService ().post (std::bind (&SSU2Session::Terminate, it.second)); |
|
|
|
|
|
|
|
else if (it.second->IsTerminationTimeoutExpired (ts)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it->second->IsEstablished ()) |
|
|
|
if (it.second->IsEstablished ()) |
|
|
|
it->second->TerminateByTimeout (); |
|
|
|
it.second->RequestTermination (); |
|
|
|
if (it->second == m_LastSession) |
|
|
|
else |
|
|
|
m_LastSession = nullptr; |
|
|
|
GetService ().post (std::bind (&SSU2Session::Terminate, it.second)); |
|
|
|
it = m_Sessions.erase (it); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
it.second->CleanUp (ts); |
|
|
|
it->second->CleanUp (ts); |
|
|
|
|
|
|
|
it++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (auto it = m_IncomingTokens.begin (); it != m_IncomingTokens.end (); ) |
|
|
|
for (auto it = m_IncomingTokens.begin (); it != m_IncomingTokens.end (); ) |
|
|
|