add relayOrder awareness to introset lookups.

* only propgate fail when relay order is non zero as zero relay order often fails
pull/1658/head
Jeff Becker 3 years ago
parent 5074dd5f2b
commit 9a1a022d62
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -1381,8 +1381,8 @@ namespace llarp
{ {
HiddenServiceAddressLookup* job = new HiddenServiceAddressLookup( HiddenServiceAddressLookup* job = new HiddenServiceAddressLookup(
this, this,
[this](auto addr, auto result, auto from, auto left) { [this](auto addr, auto result, auto from, auto left, auto order) {
return OnLookup(addr, result, from, left); return OnLookup(addr, result, from, left, order);
}, },
location, location,
PubKey{remote.as_array()}, PubKey{remote.as_array()},

@ -471,7 +471,8 @@ namespace llarp
const service::Address& addr, const service::Address& addr,
std::optional<IntroSet> i, std::optional<IntroSet> i,
const RouterID& endpoint, const RouterID& endpoint,
llarp_time_t timeLeft); llarp_time_t timeLeft,
uint64_t relayOrder);
bool bool
DoNetworkIsolation(bool failed); DoNetworkIsolation(bool failed);

@ -46,7 +46,7 @@ namespace llarp
found = *maybe; found = *maybe;
} }
} }
return handle(remote, found, endpoint, TimeLeft(time_now_ms())); return handle(remote, found, endpoint, TimeLeft(time_now_ms()), relayOrder);
} }
std::shared_ptr<routing::IMessage> std::shared_ptr<routing::IMessage>

@ -15,7 +15,7 @@ namespace llarp
uint64_t relayOrder; uint64_t relayOrder;
const dht::Key_t location; const dht::Key_t location;
using HandlerFunc = std::function<bool( using HandlerFunc = std::function<bool(
const Address&, std::optional<IntroSet>, const RouterID&, llarp_time_t)>; const Address&, std::optional<IntroSet>, const RouterID&, llarp_time_t, uint64_t)>;
HandlerFunc handle; HandlerFunc handle;
HiddenServiceAddressLookup( HiddenServiceAddressLookup(

@ -82,12 +82,17 @@ namespace llarp
remoteIntro = m_NextIntro; remoteIntro = m_NextIntro;
m_DataHandler->PutSenderFor(currentConvoTag, currentIntroSet.addressKeys, false); m_DataHandler->PutSenderFor(currentConvoTag, currentIntroSet.addressKeys, false);
m_DataHandler->PutIntroFor(currentConvoTag, remoteIntro); m_DataHandler->PutIntroFor(currentConvoTag, remoteIntro);
ShiftIntroRouter(m_NextIntro.router);
} }
} }
bool bool
OutboundContext::OnIntroSetUpdate( OutboundContext::OnIntroSetUpdate(
const Address&, std::optional<IntroSet> foundIntro, const RouterID& endpoint, llarp_time_t) const Address&,
std::optional<IntroSet> foundIntro,
const RouterID& endpoint,
llarp_time_t,
uint64_t relayOrder)
{ {
if (markedBad) if (markedBad)
return true; return true;
@ -112,8 +117,9 @@ namespace llarp
return true; return true;
} }
currentIntroSet = *foundIntro; currentIntroSet = *foundIntro;
ShiftIntroRouter(RouterID{});
} }
else else if (relayOrder > 0)
{ {
++m_LookupFails; ++m_LookupFails;
LogWarn(Name(), " failed to look up introset, fails=", m_LookupFails); LogWarn(Name(), " failed to look up introset, fails=", m_LookupFails);

Loading…
Cancel
Save