From e1f90e5e5acef0b2efd82caf9bbb1b0a61a4f47e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 7 Apr 2021 06:21:27 -0400 Subject: [PATCH] use rx id on snode side of paths set protocol on reply routing messages --- llarp/exit/endpoint.cpp | 4 +++- llarp/handlers/exit.cpp | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/llarp/exit/endpoint.cpp b/llarp/exit/endpoint.cpp index b2e479108..a99eabeea 100644 --- a/llarp/exit/endpoint.cpp +++ b/llarp/exit/endpoint.cpp @@ -190,15 +190,17 @@ namespace llarp if (queue.size() == 0) { queue.emplace_back(); + queue.back().protocol = type; return queue.back().PutBuffer(pktbuf, m_Counter++); } auto& msg = queue.back(); if (msg.Size() + pktbuf.sz > llarp::routing::ExitPadSize) { queue.emplace_back(); + queue.back().protocol = type; return queue.back().PutBuffer(pktbuf, m_Counter++); } - + msg.protocol = type; return msg.PutBuffer(pktbuf, m_Counter++); } diff --git a/llarp/handlers/exit.cpp b/llarp/handlers/exit.cpp index b950a0b9f..48a643e53 100644 --- a/llarp/handlers/exit.cpp +++ b/llarp/handlers/exit.cpp @@ -64,18 +64,21 @@ namespace llarp { service::ConvoTag tag{}; auto visit = [&tag](exit::Endpoint* const ep) -> bool { - if (ep) - tag = service::ConvoTag{ep->LocalPath().as_array()}; + if (not ep) + return false; + tag = service::ConvoTag{ep->LocalPath().as_array()}; return true; }; if (VisitEndpointsFor(PubKey{*rid}, visit) and not tag.IsZero()) return tag; auto itr = m_SNodeSessions.find(*rid); if (itr == m_SNodeSessions.end()) + { return std::nullopt; + } if (auto path = itr->second->GetPathByRouter(*rid)) { - tag = service::ConvoTag{path->TXID().as_array()}; + tag = service::ConvoTag{path->RXID().as_array()}; return tag; } return std::nullopt; @@ -144,7 +147,7 @@ namespace llarp { if (auto path = session->GetPathByRouter(routerID)) { - hook(service::ConvoTag{path->TXID().as_array()}); + hook(service::ConvoTag{path->RXID().as_array()}); } else hook(std::nullopt);