mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
fix utp leak in unit tests
This commit is contained in:
parent
f9d30b9b96
commit
19a4a3ddbc
2 changed files with 21 additions and 3 deletions
|
@ -595,7 +595,7 @@ namespace llarp
|
|||
|
||||
lastActive = parent->Now();
|
||||
|
||||
Pump = std::bind(&Session::PumpWrite, this);
|
||||
Pump = std::bind(&Session::DoPump, this);
|
||||
Tick = std::bind(&Session::TickImpl, this, std::placeholders::_1);
|
||||
SendMessageBuffer =
|
||||
std::bind(&Session::QueueWriteBuffers, this, std::placeholders::_1);
|
||||
|
@ -717,6 +717,15 @@ namespace llarp
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Session::DoPump()
|
||||
{
|
||||
// pump write queue
|
||||
PumpWrite();
|
||||
// prune inbound messages
|
||||
PruneInboundMessages(parent->Now());
|
||||
}
|
||||
|
||||
bool
|
||||
Session::QueueWriteBuffers(llarp_buffer_t buf)
|
||||
{
|
||||
|
@ -894,8 +903,14 @@ namespace llarp
|
|||
Addr remote(*arg->address);
|
||||
llarp::LogDebug("utp accepted from ", remote);
|
||||
Session* session = new Session(self, arg->socket, remote);
|
||||
self->PutSession(session);
|
||||
session->OnLinkEstablished(self);
|
||||
if(!self->PutSession(session))
|
||||
{
|
||||
session->Close();
|
||||
delete session;
|
||||
}
|
||||
else
|
||||
session->OnLinkEstablished(self);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,9 @@ namespace llarp
|
|||
void
|
||||
PumpWrite();
|
||||
|
||||
void
|
||||
DoPump();
|
||||
|
||||
/// verify a fragment buffer and the decrypt it
|
||||
/// buf is assumed to be FragmentBufferSize bytes long
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue