lokinet/llarp/dns
Jason Rhinelander 36792d4337
Fix multi-field < ordering
Lots and lots of places in the code had broken < operators because they
are returning something like:

    foo < other.foo or bar < other.bar;

but this breaks both the strict weak ordering requirements that are
required for the "Compare" requirement for things like
std::map/set/priority_queue.

For example:

    a = {.foo=1, .bar=3}
    b = {.foo=3, .bar=1}

does not have an ordering over a and b (both `a < b` and `b < a` are
satisfied at the same time).

This needs to be instead something like:

    foo < other.foo or (foo == other.foo and bar < other.bar)

but that's a bit clunkier, and it is easier to use std::tie for tuple's
built-in < comparison which does the right thing:

    std::tie(foo, bar) < std::tie(other.foo, other.bar)

(Initially I noticed this in SockAddr/sockaddr_in6, but upon further
investigation this extends to the major of multi-field `operator<`'s.)

This fixes it by using std::tie (or something similar) everywhere we are
doing multi-field inequalities.
2022-10-13 16:29:13 -03:00
..
dns.hpp standardize include format and pragma once 2021-03-09 19:01:41 -05:00
message.cpp llarp/dns logging refactor 2022-09-19 20:26:36 -03:00
message.hpp refactor dns subsystem 2022-09-08 14:23:52 -04:00
name.cpp DNS message parsing fixes and cleanup 2022-07-20 16:50:38 -03:00
name.hpp DNS message parsing fixes and cleanup 2022-07-20 16:50:38 -03:00
nm_platform.cpp changeset for windows port 2022-09-08 14:24:59 -04:00
nm_platform.hpp disable lokinet-bootstrap on windows builds 2022-09-08 14:25:00 -04:00
platform.cpp Apple DNS fix WIP 2022-09-19 20:26:40 -03:00
platform.hpp changeset for windows port 2022-09-08 14:24:59 -04:00
query.hpp standardize include format and pragma once 2021-03-09 19:01:41 -05:00
question.cpp llarp/dns logging refactor 2022-09-19 20:26:36 -03:00
question.hpp DNS message parsing fixes and cleanup 2022-07-20 16:50:38 -03:00
rr.cpp llarp/dns logging refactor 2022-09-19 20:26:36 -03:00
rr.hpp DNS message parsing fixes and cleanup 2022-07-20 16:50:38 -03:00
sd_platform.cpp changeset for windows port 2022-09-08 14:24:59 -04:00
sd_platform.hpp disable lokinet-bootstrap on windows builds 2022-09-08 14:25:00 -04:00
serialize.cpp standardize include format and pragma once 2021-03-09 19:01:41 -05:00
serialize.hpp macos sort of works now 2021-09-02 14:17:09 -04:00
server.cpp Windows compilation fix 2022-09-19 20:26:41 -03:00
server.hpp Format fixes & fix warning in format script 2022-09-19 20:26:40 -03:00
srv_data.cpp llarp/dns logging refactor 2022-09-19 20:26:36 -03:00
srv_data.hpp Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
string.hpp standardize include format and pragma once 2021-03-09 19:01:41 -05:00
unbound_resolver.cpp llarp/dns logging refactor 2022-09-19 20:26:36 -03:00
unbound_resolver.hpp Forward-declare ub_ctx/ub_result 2021-09-02 14:17:11 -04:00
win32_platform.cpp changeset for windows port 2022-09-08 14:24:59 -04:00
win32_platform.hpp changeset for windows port 2022-09-08 14:24:59 -04:00