diff --git a/docs/dht_v0.txt b/docs/dht_v0.txt index b47c8e44b..868ea3d57 100644 --- a/docs/dht_v0.txt +++ b/docs/dht_v0.txt @@ -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 +} \ No newline at end of file diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 89e19e778..ad5f506b6 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -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