Skip to content

Commit

Permalink
try to send lookup reply directly to IBGW
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Mar 4, 2024
1 parent e85e96b commit 2dbf094
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions libi2pd/NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,12 +1114,24 @@ namespace data
else
LogPrint(eLogWarning, "NetDb: Encrypted reply requested but no tags provided");
}
auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool ();
auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr;
if (outbound)
outbound->SendTunnelDataMsgTo (replyIdent, replyTunnelID, replyMsg);
else
bool direct = true;
if (!i2p::transport::transports.IsConnected (ident))
{
auto r = FindRouter (replyIdent);
if (r && !r->IsReachableFrom (i2p::context.GetRouterInfo ()))
direct = false;
}
if (direct)
transports.SendMessage (replyIdent, i2p::CreateTunnelGatewayMsg (replyTunnelID, replyMsg));
else
{
auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool ();
auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr;
if (outbound)
outbound->SendTunnelDataMsgTo (replyIdent, replyTunnelID, replyMsg);
else
LogPrint (eLogWarning, "NetDb: Can't send lookup reply to ", replyIdent.ToBase64 (), ". Non reachable and no outbound tunnels");
}
}
else
transports.SendMessage (replyIdent, replyMsg);
Expand Down

0 comments on commit 2dbf094

Please sign in to comment.