use rx id on snode side of paths

set protocol on reply routing messages
pull/1576/head
Jeff Becker 3 years ago
parent e058b873b6
commit e1f90e5e5a
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -190,15 +190,17 @@ namespace llarp
if (queue.size() == 0) if (queue.size() == 0)
{ {
queue.emplace_back(); queue.emplace_back();
queue.back().protocol = type;
return queue.back().PutBuffer(pktbuf, m_Counter++); return queue.back().PutBuffer(pktbuf, m_Counter++);
} }
auto& msg = queue.back(); auto& msg = queue.back();
if (msg.Size() + pktbuf.sz > llarp::routing::ExitPadSize) if (msg.Size() + pktbuf.sz > llarp::routing::ExitPadSize)
{ {
queue.emplace_back(); queue.emplace_back();
queue.back().protocol = type;
return queue.back().PutBuffer(pktbuf, m_Counter++); return queue.back().PutBuffer(pktbuf, m_Counter++);
} }
msg.protocol = type;
return msg.PutBuffer(pktbuf, m_Counter++); return msg.PutBuffer(pktbuf, m_Counter++);
} }

@ -64,18 +64,21 @@ namespace llarp
{ {
service::ConvoTag tag{}; service::ConvoTag tag{};
auto visit = [&tag](exit::Endpoint* const ep) -> bool { auto visit = [&tag](exit::Endpoint* const ep) -> bool {
if (ep) if (not ep)
tag = service::ConvoTag{ep->LocalPath().as_array()}; return false;
tag = service::ConvoTag{ep->LocalPath().as_array()};
return true; return true;
}; };
if (VisitEndpointsFor(PubKey{*rid}, visit) and not tag.IsZero()) if (VisitEndpointsFor(PubKey{*rid}, visit) and not tag.IsZero())
return tag; return tag;
auto itr = m_SNodeSessions.find(*rid); auto itr = m_SNodeSessions.find(*rid);
if (itr == m_SNodeSessions.end()) if (itr == m_SNodeSessions.end())
{
return std::nullopt; return std::nullopt;
}
if (auto path = itr->second->GetPathByRouter(*rid)) if (auto path = itr->second->GetPathByRouter(*rid))
{ {
tag = service::ConvoTag{path->TXID().as_array()}; tag = service::ConvoTag{path->RXID().as_array()};
return tag; return tag;
} }
return std::nullopt; return std::nullopt;
@ -144,7 +147,7 @@ namespace llarp
{ {
if (auto path = session->GetPathByRouter(routerID)) if (auto path = session->GetPathByRouter(routerID))
{ {
hook(service::ConvoTag{path->TXID().as_array()}); hook(service::ConvoTag{path->RXID().as_array()});
} }
else else
hook(std::nullopt); hook(std::nullopt);

Loading…
Cancel
Save