1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 08:14:15 +00:00

speed-up destination request

This commit is contained in:
orignal 2014-08-24 21:17:21 -04:00
parent 0e230fdd05
commit d231e59f0c

View File

@ -451,11 +451,9 @@ namespace data
bool deleteDest = true; bool deleteDest = true;
if (num > 0) if (num > 0)
{ {
auto exploratoryPool = dest ? dest->GetTunnelPool () : nullptr; auto pool = dest ? dest->GetTunnelPool () : nullptr;
if (!exploratoryPool) auto outbound = pool ? pool->GetNextOutboundTunnel () : i2p::tunnel::tunnels.GetNextOutboundTunnel ();
exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); auto inbound = pool ? pool->GetNextInboundTunnel () : i2p::tunnel::tunnels.GetNextInboundTunnel ();
auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr;
auto inbound = exploratoryPool ? exploratoryPool->GetNextInboundTunnel () : nullptr;
std::vector<i2p::tunnel::TunnelMessageBlock> msgs; std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
@ -475,7 +473,7 @@ namespace data
LogPrint ("Found new/outdated router. Requesting RouterInfo ..."); LogPrint ("Found new/outdated router. Requesting RouterInfo ...");
if (outbound && inbound && dest->GetLastRouter ()) if (outbound && inbound && dest->GetLastRouter ())
{ {
RequestedDestination * d1 = CreateRequestedDestination (router, false, false, exploratoryPool); RequestedDestination * d1 = CreateRequestedDestination (router, false, false, pool);
auto msg = d1->CreateRequestMessage (dest->GetLastRouter (), inbound); auto msg = d1->CreateRequestMessage (dest->GetLastRouter (), inbound);
msgs.push_back (i2p::tunnel::TunnelMessageBlock msgs.push_back (i2p::tunnel::TunnelMessageBlock
{ {
@ -521,7 +519,7 @@ namespace data
{ {
// request router // request router
LogPrint ("Found new floodfill. Request it"); LogPrint ("Found new floodfill. Request it");
RequestedDestination * d2 = CreateRequestedDestination (router, false, false, exploratoryPool); RequestedDestination * d2 = CreateRequestedDestination (router, false, false, pool);
I2NPMessage * msg = d2->CreateRequestMessage (dest->GetLastRouter (), inbound); I2NPMessage * msg = d2->CreateRequestMessage (dest->GetLastRouter (), inbound);
msgs.push_back (i2p::tunnel::TunnelMessageBlock msgs.push_back (i2p::tunnel::TunnelMessageBlock
{ {