lokinet/llarp
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
..
android standardize include format and pragma once 2021-03-09 19:01:41 -05:00
apple Add ring buffer sink to macos build 2022-10-06 11:56:06 -03:00
config Add binary file slurp/dump utility functions 2022-10-05 16:34:32 -03:00
consensus Apply some lipstick to llarp_buffer_t 2022-09-19 20:25:51 -03:00
constants disable lokinet-bootstrap on windows builds 2022-09-08 14:25:00 -04:00
crypto Add binary file slurp/dump utility functions 2022-10-05 16:34:32 -03:00
dht llarp_buffer_t: rename badly named operator== 2022-09-19 20:25:51 -03:00
dns Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
ev disable lokinet-bootstrap on windows builds 2022-09-08 14:25:00 -04:00
exit llarp_buffer_t: rename badly named operator== 2022-09-19 20:25:51 -03:00
handlers Format fixes & fix warning in format script 2022-09-19 20:26:40 -03:00
iwp Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
link Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
linux restucture dbus parts 2022-09-08 14:23:53 -04:00
messages llarp_buffer_t: rename badly named operator== 2022-09-19 20:25:51 -03:00
net Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
path changeset for windows port 2022-09-08 14:24:59 -04:00
peerstats Remove unused parameter names 2022-08-30 15:53:40 -03:00
quic Apply some lipstick to llarp_buffer_t 2022-09-19 20:25:51 -03:00
router Add more logging around route poking conditions 2022-10-06 21:32:57 -03:00
routing llarp_buffer_t: rename badly named operator== 2022-09-19 20:25:51 -03:00
rpc Merge pull request #1991 from jagerman/lokinet-vpn-cleanups 2022-10-06 16:09:56 -03:00
service Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
simulation standardize include format and pragma once 2021-03-09 19:01:41 -05:00
tooling hive fmt/spdlog updates 2022-07-19 15:27:31 -03:00
util Fallback bootstrap router build parameter 2022-10-06 13:59:47 -03:00
vpn Fix multi-field < ordering 2022-10-13 16:29:13 -03:00
win32 De-prioritize some windivert logging 2022-10-06 21:32:58 -03:00
CMakeLists.txt Add InterfaceInfo formatter 2022-10-06 21:32:57 -03:00
app.xml stray tag ;-; 2018-12-24 22:39:34 -06:00
bootstrap-fallbacks.cpp.in bake in bootstrap fallbacks at build time 2022-10-06 13:59:49 -03:00
bootstrap.cpp Fallback bootstrap router build parameter 2022-10-06 13:59:47 -03:00
bootstrap.hpp bake in bootstrap fallbacks at build time 2022-10-06 13:59:49 -03:00
context.cpp fix up log statements 2022-08-22 16:50:46 -04:00
endpoint_base.cpp add untracked file 2021-04-19 07:02:44 -04:00
endpoint_base.hpp refactor dns subsystem 2022-09-08 14:23:52 -04:00
lokinet_shared.cpp changeset for windows port 2022-09-08 14:24:59 -04:00
nodedb.cpp Merge pull request #1991 from jagerman/lokinet-vpn-cleanups 2022-10-06 16:09:56 -03:00
nodedb.hpp liblokinet additions: 2021-04-19 06:59:07 -04:00
pow.cpp Remote util::Printer and related cruft 2022-07-18 14:56:09 -03:00
pow.hpp Remote util::Printer and related cruft 2022-07-18 14:56:09 -03:00
profiling.cpp llarp/profiling: refactor to use oxenc producer/consumer 2022-10-05 16:35:16 -03:00
profiling.hpp llarp/profiling: refactor to use oxenc producer/consumer 2022-10-05 16:35:16 -03:00
router_contact.cpp Fallback bootstrap router build parameter 2022-10-06 13:59:47 -03:00
router_contact.hpp Fallback bootstrap router build parameter 2022-10-06 13:59:47 -03:00
router_id.cpp Crank oxen-mq to (1.2.)11; switch to oxen-encoding 2022-02-17 16:30:17 -04:00
router_id.hpp Replace logging with oxen-logger 2022-07-15 22:17:59 -03:00
router_version.cpp Cleanup: avoid pointless copy of `this` pointer 2021-11-15 13:38:00 -04:00
router_version.hpp Fix multi-field < ordering 2022-10-13 16:29:13 -03:00