|
|
@ -534,20 +534,20 @@ namespace data |
|
|
|
|
|
|
|
|
|
|
|
void NetDb::Explore () |
|
|
|
void NetDb::Explore () |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); |
|
|
|
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator (); |
|
|
|
auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr; |
|
|
|
uint8_t randomHash[32]; |
|
|
|
auto inbound = exploratoryPool ? exploratoryPool->GetNextInboundTunnel () : nullptr; |
|
|
|
rnd.GenerateBlock (randomHash, 32); |
|
|
|
if (outbound && inbound) |
|
|
|
RequestedDestination * dest = CreateRequestedDestination (IdentHash (randomHash), false, true); |
|
|
|
|
|
|
|
auto floodfill = GetClosestFloodfill (randomHash, dest->GetExcludedPeers ()); |
|
|
|
|
|
|
|
if (floodfill) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator (); |
|
|
|
LogPrint ("Exploring new routers ..."); |
|
|
|
uint8_t randomHash[32]; |
|
|
|
auto exploratoryPool = i2p::tunnel::tunnels.GetExploratoryPool (); |
|
|
|
rnd.GenerateBlock (randomHash, 32); |
|
|
|
auto outbound = exploratoryPool ? exploratoryPool->GetNextOutboundTunnel () : nullptr; |
|
|
|
RequestedDestination * dest = CreateRequestedDestination (IdentHash (randomHash), false, true); |
|
|
|
auto inbound = exploratoryPool ? exploratoryPool->GetNextInboundTunnel () : nullptr; |
|
|
|
dest->SetLastOutboundTunnel (outbound); |
|
|
|
if (outbound && inbound) |
|
|
|
auto floodfill = GetClosestFloodfill (randomHash, dest->GetExcludedPeers ()); |
|
|
|
|
|
|
|
if (floodfill) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Exploring new routers ..."); |
|
|
|
dest->SetLastOutboundTunnel (outbound); |
|
|
|
std::vector<i2p::tunnel::TunnelMessageBlock> msgs; |
|
|
|
std::vector<i2p::tunnel::TunnelMessageBlock> msgs; |
|
|
|
msgs.push_back (i2p::tunnel::TunnelMessageBlock |
|
|
|
msgs.push_back (i2p::tunnel::TunnelMessageBlock |
|
|
|
{ |
|
|
|
{ |
|
|
@ -564,8 +564,14 @@ namespace data |
|
|
|
outbound->SendTunnelDataMsg (msgs); |
|
|
|
outbound->SendTunnelDataMsg (msgs); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
DeleteRequestedDestination (dest); |
|
|
|
{ |
|
|
|
|
|
|
|
dest->SetLastOutboundTunnel (nullptr); |
|
|
|
|
|
|
|
dest->SetLastReplyTunnel (nullptr); |
|
|
|
|
|
|
|
i2p::transports.SendMessage (floodfill->GetIdentHash (), dest->CreateRequestMessage (floodfill->GetIdentHash ())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
DeleteRequestedDestination (dest); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void NetDb::Publish () |
|
|
|
void NetDb::Publish () |
|
|
|