check if pool is ready before sending next request

gha
orignal 1 month ago
parent cc75ccd070
commit 146b3f52c0

@ -199,22 +199,30 @@ namespace data
else else
{ {
auto pool = i2p::tunnel::tunnels.GetExploratoryPool (); auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
auto outbound = pool->GetNextOutboundTunnel (); if (pool)
auto inbound = pool->GetNextInboundTunnel (); {
if (nextFloodfill && outbound && inbound) auto outbound = pool->GetNextOutboundTunnel ();
{ auto inbound = pool->GetNextInboundTunnel ();
LogPrint (eLogDebug, "NetDbReq: Try ", dest->GetDestination ().ToBase64 (), " at ", count, " floodfill ", nextFloodfill->GetIdentHash ().ToBase64 (), " through tunnels"); if (nextFloodfill && outbound && inbound)
auto msg = dest->CreateRequestMessage (nextFloodfill, inbound); {
msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->SendNextRequest (dest); }; LogPrint (eLogDebug, "NetDbReq: Try ", dest->GetDestination ().ToBase64 (), " at ", count, " floodfill ", nextFloodfill->GetIdentHash ().ToBase64 (), " through tunnels");
outbound->SendTunnelDataMsgTo (nextFloodfill->GetIdentHash (), 0, auto msg = dest->CreateRequestMessage (nextFloodfill, inbound);
i2p::garlic::WrapECIESX25519MessageForRouter (msg, nextFloodfill->GetIdentity ()->GetEncryptionPublicKey ())); msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->SendNextRequest (dest); };
outbound->SendTunnelDataMsgTo (nextFloodfill->GetIdentHash (), 0,
i2p::garlic::WrapECIESX25519MessageForRouter (msg, nextFloodfill->GetIdentity ()->GetEncryptionPublicKey ()));
}
else
{
ret = false;
if (!inbound) LogPrint (eLogWarning, "NetDbReq: No inbound tunnels");
if (!outbound) LogPrint (eLogWarning, "NetDbReq: No outbound tunnels");
}
} }
else else
{ {
ret = false; ret = false;
if (!inbound) LogPrint (eLogWarning, "NetDbReq: No inbound tunnels"); LogPrint (eLogWarning, "NetDbReq: Exploratory pool is not ready");
if (!outbound) LogPrint (eLogWarning, "NetDbReq: No outbound tunnels"); }
}
} }
} }
else else

Loading…
Cancel
Save