properly close dropped inbound sessions on utp

pull/747/head
Jeff Becker 5 years ago
parent aa0a795689
commit f37552bbd3
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -32,6 +32,8 @@ namespace llarp
Session* session = static_cast< Session* >(utp_get_userdata(arg->socket));
if(session && l)
session->OutboundLinkEstablished(l);
else
utp_close(arg->socket);
return 0;
}
@ -59,6 +61,10 @@ namespace llarp
link->HandleTimeout(session);
session->Close();
}
else
{
utp_close(arg->socket);
}
return 0;
}
@ -319,15 +325,18 @@ namespace llarp
LinkLayer* self =
static_cast< LinkLayer* >(utp_context_get_userdata(arg->context));
Addr remote(*arg->address);
LogDebug("utp accepted from ", remote);
std::shared_ptr< ILinkSession > session =
std::make_shared< InboundSession >(self, arg->socket, remote);
if(!self->PutSession(session))
{
LogWarn("dropping inbound utp session from ", remote);
utp_close(arg->socket);
session->Close();
}
else
{
LogDebug("utp accepted from ", remote);
session->OnLinkEstablished(self);
}
return 0;

Loading…
Cancel
Save