mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
dont use std::optional
This commit is contained in:
parent
4478cf6f72
commit
f7424b8bbe
|
@ -1022,19 +1022,16 @@ namespace llarp
|
|||
bool
|
||||
PeerSelectionConfig::Acceptable(const std::set<RouterContact>& rcs) const
|
||||
{
|
||||
if (m_UniqueHopsNetmaskSize)
|
||||
const auto netmask = netmask_ipv6_bits(96 + m_UniqueHopsNetmaskSize);
|
||||
std::set<IPRange> seenRanges;
|
||||
for (const auto& hop : rcs)
|
||||
{
|
||||
const auto netmask = netmask_ipv6_bits(96 + *m_UniqueHopsNetmaskSize);
|
||||
std::set<IPRange> seenRanges;
|
||||
for (const auto& hop : rcs)
|
||||
for (const auto& addr : hop.addrs)
|
||||
{
|
||||
for (const auto& addr : hop.addrs)
|
||||
const auto network_addr = net::In6ToHUInt(addr.ip) & netmask;
|
||||
if (auto [it, inserted] = seenRanges.emplace(network_addr, netmask); not inserted)
|
||||
{
|
||||
const auto network_addr = net::In6ToHUInt(addr.ip) & netmask;
|
||||
if (auto [it, inserted] = seenRanges.emplace(network_addr, netmask); not inserted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace llarp
|
|||
/// in our hops what netmask will we use for unique ips for hops
|
||||
/// i.e. 32 for every hop unique ip, 24 unique /24 per hop, etc
|
||||
///
|
||||
std::optional<int> m_UniqueHopsNetmaskSize;
|
||||
int m_UniqueHopsNetmaskSize;
|
||||
|
||||
/// set of countrys to exclude from path building (2 char country code)
|
||||
std::unordered_set<std::string> m_ExcludeCountries;
|
||||
|
|
Loading…
Reference in a new issue