fix reply logic

pull/15/head
Jeff Becker 6 years ago
parent efc6e23c6f
commit 8e4b0a7963
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -720,10 +720,7 @@ namespace llarp
Endpoint::HandleDataMessage(const PathID_t& src, ProtocolMessage* msg) Endpoint::HandleDataMessage(const PathID_t& src, ProtocolMessage* msg)
{ {
msg->sender.UpdateAddr(); msg->sender.UpdateAddr();
auto path = GetPathByID(src); PutIntroFor(msg->tag, msg->introReply);
if(!path)
return false;
PutIntroFor(msg->tag, path->intro);
EnsureReplyPath(msg->sender); EnsureReplyPath(msg->sender);
return ProcessDataMessage(msg); return ProcessDataMessage(msg);
} }
@ -1036,15 +1033,14 @@ namespace llarp
AsyncKeyExchange(llarp_logic* l, llarp_crypto* c, const ServiceInfo& r, AsyncKeyExchange(llarp_logic* l, llarp_crypto* c, const ServiceInfo& r,
const Identity& localident, const Identity& localident,
const PQPubKey& introsetPubKey, const Introduction& us, const PQPubKey& introsetPubKey,
const Introduction& them, IDataHandler* h) const Introduction& remote, IDataHandler* h)
: logic(l) : logic(l)
, crypto(c) , crypto(c)
, remote(r) , remote(r)
, m_LocalIdentity(localident) , m_LocalIdentity(localident)
, intro(us)
, introPubKey(introsetPubKey) , introPubKey(introsetPubKey)
, remoteIntro(them) , remoteIntro(remote)
, handler(h) , handler(h)
{ {
} }
@ -1086,8 +1082,6 @@ namespace llarp
self->msg.tag.Randomize(); self->msg.tag.Randomize();
// set sender // set sender
self->msg.sender = self->m_LocalIdentity.pub; self->msg.sender = self->m_LocalIdentity.pub;
// set our introduction
self->msg.introReply = self->intro;
// set version // set version
self->msg.version = LLARP_PROTO_VERSION; self->msg.version = LLARP_PROTO_VERSION;
// set protocol // set protocol
@ -1120,10 +1114,10 @@ namespace llarp
if(path == nullptr) if(path == nullptr)
return; return;
AsyncKeyExchange* ex = new AsyncKeyExchange( AsyncKeyExchange* ex =
m_Endpoint->RouterLogic(), m_Endpoint->Crypto(), remoteIdent, new AsyncKeyExchange(m_Endpoint->RouterLogic(), m_Endpoint->Crypto(),
m_Endpoint->GetIdentity(), currentIntroSet.K, path->intro, remoteIdent, m_Endpoint->GetIdentity(),
remoteIntro, m_DataHandler); currentIntroSet.K, remoteIntro, m_DataHandler);
ex->hook = std::bind(&Endpoint::OutboundContext::Send, this, ex->hook = std::bind(&Endpoint::OutboundContext::Send, this,
std::placeholders::_1); std::placeholders::_1);
ex->msg.PutBuffer(payload); ex->msg.PutBuffer(payload);

Loading…
Cancel
Save