update docs and discard pending traffic on connect timeout to prevent memleak

pull/630/head
Jeff Becker 5 years ago
parent af37f099c4
commit 72dbbd53d6
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -85,6 +85,19 @@ decrement S by 1 and forward to dht peer who is next closest to
the SA of the IS. If S is greater than 3, don't store the IS and
discard this message.
acknoledge introduction message (AIM)
acknoledge the publishing of an introduction
{
A: "A",
P: published_to_counter,
T: transaction_id_uint64,
V: 0
}
increment P by 1 and forward to requester
find router contact message (FRCM)
@ -130,3 +143,11 @@ in response to an exploritory router lookup, where FRCM.E is provided and non ze
T: transaction_id_uint64,
V: 0
}
sent in reply to a dht request to indicate transaction timeout
{
A: "T",
T: transaction_id_uint64,
V: 0
}

@ -61,16 +61,6 @@ struct TryConnectJob
return now > lastAttempt && now - lastAttempt > 5000;
}
void
Failed()
{
llarp::LogInfo("session to ", llarp::RouterID(rc.pubkey), " closed");
if(link)
link->CloseSessionTo(rc.pubkey);
// delete this
router->pendingEstablishJobs.erase(rc.pubkey);
}
void
Success()
{
@ -86,6 +76,8 @@ struct TryConnectJob
{
return Attempt();
}
// discard pending traffic on timeout
router->DiscardOutboundFor(rc.pubkey);
router->routerProfiling().MarkConnectTimeout(rc.pubkey);
if(router->routerProfiling().IsBad(rc.pubkey))
{
@ -537,7 +529,7 @@ namespace llarp
async_verify_context *ctx =
static_cast< async_verify_context * >(job->user);
auto router = ctx->router;
PubKey pk(job->rc.pubkey);
const PubKey pk(job->rc.pubkey);
router->m_Clients.insert(pk);
router->FlushOutboundFor(pk, router->GetLinkWithSessionByPubkey(pk));
delete ctx;
@ -551,18 +543,12 @@ namespace llarp
async_verify_context *ctx =
static_cast< async_verify_context * >(job->user);
auto router = ctx->router;
PubKey pk(job->rc.pubkey);
const PubKey pk(job->rc.pubkey);
if(!job->valid)
{
if(ctx->establish_job)
{
// was an outbound attempt
ctx->establish_job->Failed();
}
delete ctx;
router->DiscardOutboundFor(pk);
router->pendingVerifyRC.erase(pk);
return;
}
// we're valid, which means it's already been committed to the nodedb

Loading…
Cancel
Save