mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00: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,7 +357,8 @@ 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)
|
||||||
{
|
{
|
||||||
// pick random next good lease
|
// pick random next good lease
|
||||||
@ -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…
x
Reference in New Issue
Block a user