mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
terminate session in separate task
This commit is contained in:
parent
6b513a0f95
commit
4b1f5c9c9b
|
@ -403,7 +403,7 @@ namespace transport
|
||||||
case eSSU2SessionStateSessionCreatedSent:
|
case eSSU2SessionStateSessionCreatedSent:
|
||||||
if (!m_LastSession->ProcessSessionConfirmed (buf, len))
|
if (!m_LastSession->ProcessSessionConfirmed (buf, len))
|
||||||
{
|
{
|
||||||
m_LastSession->Terminate ();
|
m_LastSession->Done ();
|
||||||
m_LastSession = nullptr;
|
m_LastSession = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -416,7 +416,7 @@ namespace transport
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: HolePunch endpoint ", senderEndpoint,
|
LogPrint (eLogWarning, "SSU2: HolePunch endpoint ", senderEndpoint,
|
||||||
" doesn't match RelayResponse ", m_LastSession->GetRemoteEndpoint ());
|
" doesn't match RelayResponse ", m_LastSession->GetRemoteEndpoint ());
|
||||||
m_LastSession->Terminate ();
|
m_LastSession->Done ();
|
||||||
m_LastSession = nullptr;
|
m_LastSession = nullptr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -678,13 +678,13 @@ namespace transport
|
||||||
{
|
{
|
||||||
auto state = it.second->GetState ();
|
auto state = it.second->GetState ();
|
||||||
if (state == eSSU2SessionStateTerminated || state == eSSU2SessionStateClosing)
|
if (state == eSSU2SessionStateTerminated || state == eSSU2SessionStateClosing)
|
||||||
GetService ().post (std::bind (&SSU2Session::Terminate, it.second));
|
it.second->Done ();
|
||||||
else if (it.second->IsTerminationTimeoutExpired (ts))
|
else if (it.second->IsTerminationTimeoutExpired (ts))
|
||||||
{
|
{
|
||||||
if (it.second->IsEstablished ())
|
if (it.second->IsEstablished ())
|
||||||
it.second->RequestTermination (eSSU2TerminationReasonIdleTimeout);
|
it.second->RequestTermination (eSSU2TerminationReasonIdleTimeout);
|
||||||
else
|
else
|
||||||
GetService ().post (std::bind (&SSU2Session::Terminate, it.second));
|
it.second->Done ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
it.second->CleanUp (ts);
|
it.second->CleanUp (ts);
|
||||||
|
|
|
@ -1338,7 +1338,7 @@ namespace transport
|
||||||
if (IsEstablished () && buf[11] != eSSU2TerminationReasonTerminationReceived)
|
if (IsEstablished () && buf[11] != eSSU2TerminationReasonTerminationReceived)
|
||||||
RequestTermination (eSSU2TerminationReasonTerminationReceived);
|
RequestTermination (eSSU2TerminationReasonTerminationReceived);
|
||||||
else
|
else
|
||||||
Terminate ();
|
Done ();
|
||||||
break;
|
break;
|
||||||
case eSSU2BlkRelayRequest:
|
case eSSU2BlkRelayRequest:
|
||||||
LogPrint (eLogDebug, "SSU2: RelayRequest");
|
LogPrint (eLogDebug, "SSU2: RelayRequest");
|
||||||
|
@ -1696,13 +1696,13 @@ namespace transport
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: RelayResponse signature verification failed");
|
LogPrint (eLogWarning, "SSU2: RelayResponse signature verification failed");
|
||||||
m_Server.GetService ().post (std::bind (&SSU2Session::Terminate, it->second.first));
|
it->second.first->Done ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogInfo, "SSU2: RelayResponse status code=", (int)buf[1]);
|
LogPrint (eLogInfo, "SSU2: RelayResponse status code=", (int)buf[1]);
|
||||||
m_Server.GetService ().post (std::bind (&SSU2Session::Terminate, it->second.first));
|
it->second.first->Done ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_RelaySessions.erase (it);
|
m_RelaySessions.erase (it);
|
||||||
|
@ -1898,13 +1898,13 @@ namespace transport
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: Peer test 4 address not found");
|
LogPrint (eLogWarning, "SSU2: Peer test 4 address not found");
|
||||||
it->second.first->Terminate ();
|
it->second.first->Done ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: Peer test 4 signature verification failed");
|
LogPrint (eLogWarning, "SSU2: Peer test 4 signature verification failed");
|
||||||
it->second.first->Terminate ();
|
it->second.first->Done ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1914,7 +1914,7 @@ namespace transport
|
||||||
i2p::data::GetIdentHashAbbreviation (buf[1] < 64 ? GetRemoteIdentity ()->GetIdentHash () : i2p::data::IdentHash (buf + 3)));
|
i2p::data::GetIdentHashAbbreviation (buf[1] < 64 ? GetRemoteIdentity ()->GetIdentHash () : i2p::data::IdentHash (buf + 3)));
|
||||||
if (GetRouterStatus () == eRouterStatusTesting)
|
if (GetRouterStatus () == eRouterStatusTesting)
|
||||||
SetRouterStatus (eRouterStatusUnknown);
|
SetRouterStatus (eRouterStatusUnknown);
|
||||||
it->second.first->Terminate ();
|
it->second.first->Done ();
|
||||||
}
|
}
|
||||||
m_PeerTests.erase (it);
|
m_PeerTests.erase (it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,6 @@ namespace transport
|
||||||
void WaitForIntroduction ();
|
void WaitForIntroduction ();
|
||||||
void SendPeerTest (); // Alice, Data message
|
void SendPeerTest (); // Alice, Data message
|
||||||
void SendKeepAlive ();
|
void SendKeepAlive ();
|
||||||
void Terminate ();
|
|
||||||
void RequestTermination (SSU2TerminationReason reason);
|
void RequestTermination (SSU2TerminationReason reason);
|
||||||
void CleanUp (uint64_t ts);
|
void CleanUp (uint64_t ts);
|
||||||
void FlushData ();
|
void FlushData ();
|
||||||
|
@ -246,6 +245,7 @@ namespace transport
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void Terminate ();
|
||||||
void Established ();
|
void Established ();
|
||||||
void ScheduleConnectTimer ();
|
void ScheduleConnectTimer ();
|
||||||
void HandleConnectTimer (const boost::system::error_code& ecode);
|
void HandleConnectTimer (const boost::system::error_code& ecode);
|
||||||
|
|
Loading…
Reference in a new issue