Make Address's == and < operators consider uuid
This commit is contained in:
parent
51371398ce
commit
9056e2c97a
@ -36,14 +36,20 @@ struct Address {
|
||||
}
|
||||
|
||||
bool operator==(const Address &other) const {
|
||||
return (last_known_ip == other.last_known_ip) && (last_known_port == other.last_known_port);
|
||||
return ((unique_id == other.unique_id) && last_known_ip == other.last_known_ip) &&
|
||||
(last_known_port == other.last_known_port);
|
||||
}
|
||||
|
||||
/// unique_id is most dominant for ordering, then last_known_ip, then last_known_port
|
||||
bool operator<(const Address &other) const {
|
||||
if (last_known_ip == other.last_known_ip) {
|
||||
return last_known_port < other.last_known_port;
|
||||
if (unique_id == other.unique_id) {
|
||||
if (last_known_ip == other.last_known_ip) {
|
||||
return last_known_port < other.last_known_port;
|
||||
} else {
|
||||
return last_known_ip < other.last_known_ip;
|
||||
}
|
||||
} else {
|
||||
return last_known_ip < other.last_known_ip;
|
||||
return unique_id < other.unique_id;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user