mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
make sure we are done with session before remving it
This commit is contained in:
parent
0912de5b77
commit
262a803d10
|
@ -476,6 +476,11 @@ namespace transport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSU2Server::RequestRemoveSession (uint64_t connID)
|
||||||
|
{
|
||||||
|
GetService ().post ([connID, this]() { RemoveSession (connID); });
|
||||||
|
}
|
||||||
|
|
||||||
void SSU2Server::AddSessionByRouterHash (std::shared_ptr<SSU2Session> session)
|
void SSU2Server::AddSessionByRouterHash (std::shared_ptr<SSU2Session> session)
|
||||||
{
|
{
|
||||||
if (session)
|
if (session)
|
||||||
|
|
|
@ -82,6 +82,7 @@ namespace transport
|
||||||
|
|
||||||
void AddSession (std::shared_ptr<SSU2Session> session);
|
void AddSession (std::shared_ptr<SSU2Session> session);
|
||||||
void RemoveSession (uint64_t connID);
|
void RemoveSession (uint64_t connID);
|
||||||
|
void RequestRemoveSession (uint64_t connID);
|
||||||
void AddSessionByRouterHash (std::shared_ptr<SSU2Session> session);
|
void AddSessionByRouterHash (std::shared_ptr<SSU2Session> session);
|
||||||
bool AddPendingOutgoingSession (std::shared_ptr<SSU2Session> session);
|
bool AddPendingOutgoingSession (std::shared_ptr<SSU2Session> session);
|
||||||
void RemovePendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep);
|
void RemovePendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep);
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace transport
|
||||||
// connect
|
// connect
|
||||||
m_State = eSSU2SessionStateTokenReceived;
|
m_State = eSSU2SessionStateTokenReceived;
|
||||||
m_Server.AddPendingOutgoingSession (shared_from_this ());
|
m_Server.AddPendingOutgoingSession (shared_from_this ());
|
||||||
m_Server.RemoveSession (oldConnID);
|
m_Server.RequestRemoveSession (oldConnID);
|
||||||
Connect ();
|
Connect ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3140,7 +3140,7 @@ namespace transport
|
||||||
SendPeerTest (7, buf + offset, len - offset);
|
SendPeerTest (7, buf + offset, len - offset);
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "SSU2: Unknown address for peer test 6");
|
LogPrint (eLogWarning, "SSU2: Unknown address for peer test 6");
|
||||||
GetServer ().RemoveSession (GetConnID ());
|
GetServer ().RequestRemoveSession (GetConnID ());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: // Alice from Charlie 2
|
case 7: // Alice from Charlie 2
|
||||||
|
@ -3148,7 +3148,7 @@ namespace transport
|
||||||
auto addr = GetAddress ();
|
auto addr = GetAddress ();
|
||||||
if (addr && addr->IsV6 ())
|
if (addr && addr->IsV6 ())
|
||||||
i2p::context.SetStatusV6 (eRouterStatusOK); // set status OK for ipv6 even if from SSU2
|
i2p::context.SetStatusV6 (eRouterStatusOK); // set status OK for ipv6 even if from SSU2
|
||||||
GetServer ().RemoveSession (GetConnID ());
|
GetServer ().RequestRemoveSession (GetConnID ());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue