pull/203/head
Jeff Becker 5 years ago
parent 1a5c70f09d
commit 2a67242ccd
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -162,6 +162,13 @@ namespace llarp
return false;
}
void
ILinkLayer::RemovePending(ILinkSession * s)
{
llarp::Addr remote = s->GetRemoteEndpoint();
m_Pending.erase(remote);
}
bool
ILinkLayer::TryEstablishTo(RouterContact rc)
{

@ -170,6 +170,10 @@ namespace llarp
SessionClosedHandler SessionClosed;
SessionRenegotiateHandler SessionRenegotiate;
/// called by link session to remove a pending session who is timed out
void
RemovePending(ILinkSession * s);
private:
static void
on_timer_tick(void* user, uint64_t orig, uint64_t left)

@ -334,7 +334,9 @@ namespace llarp
link->HandleTimeout(session);
llarp::LogError(utp_error_code_names[arg->error_code], " via ",
session->remoteAddr);
session->Close();
if(arg->error_code != UTP_ETIMEDOUT)
session->Close();
link->RemovePending(session);
}
return 0;
}
@ -826,7 +828,6 @@ namespace llarp
{
if(sock)
{
utp_close(sock);
utp_set_userdata(sock, nullptr);
}
}
@ -1121,10 +1122,10 @@ namespace llarp
{
if(state == eLinkEstablished || state == eSessionReady)
{
// only call shutdown when we are actually connected
// only call shutdown and close when we are actually connected
utp_shutdown(sock, SHUT_RDWR);
utp_close(sock);
}
utp_close(sock);
llarp::LogDebug("utp_close ", remoteAddr);
utp_set_userdata(sock, nullptr);
}

@ -80,8 +80,12 @@ struct TryConnectJob
{
--triesLeft;
if(!link->TryEstablishTo(rc))
{
llarp::LogError("did not attempt connection to ", rc.pubkey,
" and it has ", rc.addrs.size(), " advertised addresses");
// delete this
router->pendingEstablishJobs.erase(rc.pubkey);
}
}
bool

Loading…
Cancel
Save