Merge pull request #1082 from majestrate/log-build-after-send-2020-02-06

only mark path build success if delivered to first hop
This commit is contained in:
Jeff 2020-02-06 12:38:38 -05:00 committed by GitHub
commit 4bc5b52762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
}