try switching logic

pull/1334/head
Jeff Becker 5 years ago
parent 92f8c059e9
commit a33dbce680
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -11,7 +11,7 @@ namespace llarp
struct NoOpCrypto final : public Crypto
{
private:
std::atomic<uint64_t> m_value;
std::atomic< uint64_t > m_value;
static constexpr byte_t MAX_BYTE = std::numeric_limits< byte_t >::max();

@ -684,9 +684,10 @@ namespace llarp
}
else
{
sendFunc = std::bind(&TunEndpoint::SendToServiceOrQueue, this,
itr->second.as_array(), std::placeholders::_1,
service::eProtocolTraffic);
sendFunc =
std::bind(&TunEndpoint::SendToServiceOrQueue, this,
service::Address(itr->second.as_array()),
std::placeholders::_1, service::eProtocolTraffic);
}
// prepare packet for insertion into network
// this includes clearing IP addresses, recalculating checksums, etc

@ -1848,10 +1848,10 @@ namespace llarp
bool
Router::HasSessionTo(const RouterID &remote) const
{
for(const auto & link : outboundLinks)
for(const auto &link : outboundLinks)
if(link->HasSessionTo(remote))
return true;
for(const auto & link : inboundLinks)
for(const auto &link : inboundLinks)
if(link->HasSessionTo(remote))
return true;
return false;

@ -821,11 +821,12 @@ namespace llarp
Endpoint::HandleDataMessage(const PathID_t& src,
std::shared_ptr< ProtocolMessage > msg)
{
msg->sender.UpdateAddr();
auto path = GetPathByID(src);
if(path)
PutReplyIntroFor(msg->tag, path->intro);
msg->sender.UpdateAddr();
PutIntroFor(msg->tag, msg->introReply);
PutIntroFor(msg->tag, path->intro);
PutSenderFor(msg->tag, msg->sender);
PutReplyIntroFor(msg->tag, msg->introReply);
EnsureReplyPath(msg->sender);
return ProcessDataMessage(msg);
}
@ -1070,11 +1071,9 @@ namespace llarp
}
bool
Endpoint::SendToServiceOrQueue(const RouterID& addr,
Endpoint::SendToServiceOrQueue(const service::Address& remote,
const llarp_buffer_t& data, ProtocolType t)
{
service::Address remote(addr.as_array());
// inbound converstation
auto now = Now();
@ -1120,8 +1119,8 @@ namespace llarp
m.introReply = p->intro;
PutReplyIntroFor(f.T, m.introReply);
m.sender = m_Identity.pub;
m.seqno = GetSeqNoForConvo(f.T);
f.F = m.introReply.pathID;
f.S = GetSeqNoForConvo(f.T);
transfer->P = remoteIntro.pathID;
if(!f.EncryptAndSign(m, K, m_Identity))
{

@ -207,8 +207,8 @@ namespace llarp
HandlePathBuilt(path::Path_ptr path) override;
bool
SendToServiceOrQueue(const RouterID& addr, const llarp_buffer_t& payload,
ProtocolType t);
SendToServiceOrQueue(const service::Address& addr,
const llarp_buffer_t& payload, ProtocolType t);
bool
SendToSNodeOrQueue(const RouterID& addr, const llarp_buffer_t& payload);

@ -59,7 +59,7 @@ namespace llarp
ProtocolFrame f;
f.N.Randomize();
f.T = currentConvoTag;
f.S = m_Endpoint->GetSeqNoForConvo(f.T);
f.S = ++sequenceNo;
auto now = m_Endpoint->Now();
if(remoteIntro.ExpiresSoon(now))
@ -87,7 +87,7 @@ namespace llarp
m_DataHandler->PutIntroFor(f.T, remoteIntro);
m_DataHandler->PutReplyIntroFor(f.T, path->intro);
m.proto = t;
m.seqno = sequenceNo++;
m.seqno = m_Endpoint->GetSeqNoForConvo(f.T);
m.introReply = path->intro;
f.F = m.introReply.pathID;
m.sender = m_Endpoint->GetIdentity().pub;

Loading…
Cancel
Save