Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net: fix incorrect less operator for top/i2p addresses #6285
The less(lhs, rhs) functions for both i2p and tor addresses do not work as expected. The logic should only be testing the ports if the hosts are equal (if currently falls back to ports if lhs.host >= rhs.host).
A concrete example:
less(addrA, addrZ) returns true (since strcmp(addrA.host, addrZ.host) < 0)
Added unit tests (and squashed/rebased). There were no unit tests for i2p so I also made i2p versions of all the tor test cases.
Running these tests without the src changes leaves you with failures:
Running with the src changes in place resolves the failures: