dont use std::optional

pull/1539/head
Jeff Becker 3 years ago
parent 4478cf6f72
commit f7424b8bbe
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -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…
Cancel
Save