You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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.
2 years ago
..
android standardize include format and pragma once 3 years ago
apple Add ring buffer sink to macos build 2 years ago
config Add binary file slurp/dump utility functions 2 years ago
consensus Apply some lipstick to llarp_buffer_t 2 years ago
constants disable lokinet-bootstrap on windows builds 2 years ago
crypto Add binary file slurp/dump utility functions 2 years ago
dht llarp_buffer_t: rename badly named operator== 2 years ago
dns Fix multi-field < ordering 2 years ago
ev disable lokinet-bootstrap on windows builds 2 years ago
exit llarp_buffer_t: rename badly named operator== 2 years ago
handlers Format fixes & fix warning in format script 2 years ago
iwp Fix multi-field < ordering 2 years ago
link Fix multi-field < ordering 2 years ago
linux restucture dbus parts 2 years ago
messages llarp_buffer_t: rename badly named operator== 2 years ago
net Fix multi-field < ordering 2 years ago
path changeset for windows port 2 years ago
peerstats Remove unused parameter names 2 years ago
quic Apply some lipstick to llarp_buffer_t 2 years ago
router Add more logging around route poking conditions 2 years ago
routing llarp_buffer_t: rename badly named operator== 2 years ago
rpc Merge pull request #1991 from jagerman/lokinet-vpn-cleanups 2 years ago
service Fix multi-field < ordering 2 years ago
simulation standardize include format and pragma once 3 years ago
tooling hive fmt/spdlog updates 2 years ago
util Fallback bootstrap router build parameter 2 years ago
vpn Fix multi-field < ordering 2 years ago
win32 De-prioritize some windivert logging 2 years ago
CMakeLists.txt Add InterfaceInfo formatter 2 years ago
app.xml stray tag ;-; 6 years ago
bootstrap-fallbacks.cpp.in bake in bootstrap fallbacks at build time 2 years ago
bootstrap.cpp Fallback bootstrap router build parameter 2 years ago
bootstrap.hpp bake in bootstrap fallbacks at build time 2 years ago
context.cpp fix up log statements 2 years ago
endpoint_base.cpp add untracked file 3 years ago
endpoint_base.hpp refactor dns subsystem 2 years ago
lokinet_shared.cpp changeset for windows port 2 years ago
nodedb.cpp Merge pull request #1991 from jagerman/lokinet-vpn-cleanups 2 years ago
nodedb.hpp liblokinet additions: 3 years ago
pow.cpp Remote util::Printer and related cruft 2 years ago
pow.hpp Remote util::Printer and related cruft 2 years ago
profiling.cpp llarp/profiling: refactor to use oxenc producer/consumer 2 years ago
profiling.hpp llarp/profiling: refactor to use oxenc producer/consumer 2 years ago
router_contact.cpp Fallback bootstrap router build parameter 2 years ago
router_contact.hpp Fallback bootstrap router build parameter 2 years ago
router_id.cpp Crank oxen-mq to (1.2.)11; switch to oxen-encoding 2 years ago
router_id.hpp Replace logging with oxen-logger 2 years ago
router_version.cpp Cleanup: avoid pointless copy of `this` pointer 3 years ago
router_version.hpp Fix multi-field < ordering 2 years ago