From 499e346da657b4a69221d71f82a72c9b3db7a4f4 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 6 Feb 2020 12:12:39 -0500 Subject: [PATCH] notify delivery of path builds --- llarp/path/pathbuilder.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/llarp/path/pathbuilder.cpp b/llarp/path/pathbuilder.cpp index 07be157dc..394e2ae37 100644 --- a/llarp/path/pathbuilder.cpp +++ b/llarp/path/pathbuilder.cpp @@ -134,16 +134,26 @@ namespace llarp { const RouterID remote = ctx->path->Upstream(); const ILinkMessage* msg = &ctx->LRCM; - if(ctx->router->SendToOrQueue(remote, msg)) + auto sentHandler = [ctx](auto status) { + if(status == SendStatus::Success) + { + ctx->router->pathContext().AddOwnPath(ctx->pathset, ctx->path); + ctx->pathset->PathBuildStarted(ctx->path); + } + else + { + LogError(ctx->pathset->Name(), " failed to send LRCM to ", + ctx->path->Upstream()); + ctx->pathset->HandlePathBuildFailed(ctx->path); + } + }; + if(ctx->router->SendToOrQueue(remote, msg, sentHandler)) { // persist session with router until this path is done ctx->router->PersistSessionUntil(remote, ctx->path->ExpireTime()); - // add own path - ctx->router->pathContext().AddOwnPath(ctx->pathset, ctx->path); - ctx->pathset->PathBuildStarted(ctx->path); } else - LogError(ctx->pathset->Name(), " failed to send LRCM to ", remote); + LogError(ctx->pathset->Name(), " failed to queue LRCM to ", remote); } }