|
|
@ -633,7 +633,7 @@ namespace data |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const RouterInfo * NetDb::GetRandomRouter (const RouterInfo * compatibleWith, uint8_t caps) const |
|
|
|
const RouterInfo * NetDb::GetRandomRouter (const RouterInfo * compatibleWith) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator (); |
|
|
|
CryptoPP::RandomNumberGenerator& rnd = i2p::context.GetRandomNumberGenerator (); |
|
|
|
uint32_t ind = rnd.GenerateWord32 (0, m_RouterInfos.size () - 1); |
|
|
|
uint32_t ind = rnd.GenerateWord32 (0, m_RouterInfos.size () - 1); |
|
|
@ -644,9 +644,8 @@ namespace data |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (i >= ind) |
|
|
|
if (i >= ind) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!it.second->IsUnreachable () && |
|
|
|
if (!it.second->IsUnreachable () && !it.second->IsHidden () && |
|
|
|
(!compatibleWith || it.second->IsCompatible (*compatibleWith)) && |
|
|
|
(!compatibleWith || it.second->IsCompatible (*compatibleWith))) |
|
|
|
(!caps || (it.second->GetCaps () & caps) == caps)) |
|
|
|
|
|
|
|
return it.second; |
|
|
|
return it.second; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|