1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 12:24:19 +00:00

fix udp tunnel route switching logic

This commit is contained in:
Jeff Becker 2016-10-04 17:50:18 -04:00
parent e4d6092939
commit ae2b5dfd3e
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B

View File

@ -276,7 +276,7 @@ namespace datagram
// our path looks dead so we need to rotate paths // our path looks dead so we need to rotate paths
if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return true; if (now - m_LastSuccess >= DATAGRAM_SESSION_PATH_TIMEOUT) return true;
// if we have a routing session and routing path we don't need to switch paths // if we have a routing session and routing path we don't need to switch paths
return m_RoutingSession != nullptr && m_RoutingSession->GetSharedRoutingPath () != nullptr; return m_RoutingSession == nullptr || m_RoutingSession->GetSharedRoutingPath () == nullptr;
} }
@ -291,7 +291,7 @@ namespace datagram
if(currentLease) // if we have a lease return true if it's about to expire otherwise return false if(currentLease) // if we have a lease return true if it's about to expire otherwise return false
return currentLease->ExpiresWithin( DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW, DATAGRAM_SESSION_LEASE_HANDOVER_FUDGE ); return currentLease->ExpiresWithin( DATAGRAM_SESSION_LEASE_HANDOVER_WINDOW, DATAGRAM_SESSION_LEASE_HANDOVER_FUDGE );
// we have no current lease, we should switch // we have no current lease, we should switch
return true; return currentLease == nullptr;
} }
std::shared_ptr<i2p::garlic::GarlicRoutingPath> DatagramSession::GetNextRoutingPath() std::shared_ptr<i2p::garlic::GarlicRoutingPath> DatagramSession::GetNextRoutingPath()