mirror of https://github.com/oxen-io/lokinet
fix minor oversight/inefficiency with already established connections
This commit is contained in:
parent
bff81c62e2
commit
8515fe09d4
|
@ -80,6 +80,14 @@ namespace llarp
|
|||
|
||||
CreatePendingSession(router);
|
||||
|
||||
// short-circuit to success callback if we already have an outbound session
|
||||
// to the remote
|
||||
if (_linkManager->HasOutboundSessionTo(router))
|
||||
{
|
||||
FinalizeRequest(router, SessionResult::Establish);
|
||||
return;
|
||||
}
|
||||
|
||||
LogDebug("Creating session establish attempt to ", router, " .");
|
||||
|
||||
auto fn = util::memFn(&OutboundSessionMaker::OnRouterContactResult, this);
|
||||
|
@ -104,6 +112,14 @@ namespace llarp
|
|||
CreatePendingSession(rc.pubkey);
|
||||
}
|
||||
|
||||
// short-circuit to success callback if we already have an outbound session
|
||||
// to the remote
|
||||
if (_linkManager->HasOutboundSessionTo(router))
|
||||
{
|
||||
FinalizeRequest(router, SessionResult::Establish);
|
||||
return;
|
||||
}
|
||||
|
||||
GotRouterContact(rc.pubkey, rc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue