mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
fixed datagram idle crash
This commit is contained in:
parent
70e4cbc023
commit
31494267e5
|
@ -318,8 +318,12 @@ namespace datagram
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
if (path->outboundTunnel && !path->outboundTunnel->IsEstablished ())
|
if (path->outboundTunnel && !path->outboundTunnel->IsEstablished ())
|
||||||
|
{
|
||||||
// bad outbound tunnel, switch outbound tunnel
|
// bad outbound tunnel, switch outbound tunnel
|
||||||
path->outboundTunnel = m_LocalDestination->GetTunnelPool()->GetNextOutboundTunnel(path->outboundTunnel);
|
path->outboundTunnel = m_LocalDestination->GetTunnelPool()->GetNextOutboundTunnel(path->outboundTunnel);
|
||||||
|
if (!path->outboundTunnel)
|
||||||
|
m_RoutingSession->SetSharedRoutingPath (nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (path->remoteLease && path->remoteLease->ExpiresWithin(DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW))
|
if (path->remoteLease && path->remoteLease->ExpiresWithin(DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW))
|
||||||
{
|
{
|
||||||
|
@ -338,11 +342,14 @@ namespace datagram
|
||||||
path->remoteLease = ls[idx];
|
path->remoteLease = ls[idx];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
path->remoteLease = nullptr;
|
m_RoutingSession->SetSharedRoutingPath (nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
// no remote lease set?
|
// no remote lease set?
|
||||||
LogPrint(eLogWarning, "DatagramSession: no cached remote lease set for ", m_RemoteIdent.ToBase32());
|
LogPrint(eLogWarning, "DatagramSession: no cached remote lease set for ", m_RemoteIdent.ToBase32());
|
||||||
|
m_RoutingSession->SetSharedRoutingPath (nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -350,6 +357,7 @@ namespace datagram
|
||||||
// no current path, make one
|
// no current path, make one
|
||||||
path = std::make_shared<i2p::garlic::GarlicRoutingPath>();
|
path = std::make_shared<i2p::garlic::GarlicRoutingPath>();
|
||||||
path->outboundTunnel = m_LocalDestination->GetTunnelPool()->GetNextOutboundTunnel();
|
path->outboundTunnel = m_LocalDestination->GetTunnelPool()->GetNextOutboundTunnel();
|
||||||
|
if (!path->outboundTunnel) return nullptr;
|
||||||
|
|
||||||
if (m_RemoteLeaseSet)
|
if (m_RemoteLeaseSet)
|
||||||
{
|
{
|
||||||
|
@ -361,6 +369,8 @@ namespace datagram
|
||||||
auto idx = rand() % sz;
|
auto idx = rand() % sz;
|
||||||
path->remoteLease = ls[idx];
|
path->remoteLease = ls[idx];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue