Skip to content

Commit

Permalink
pick: pick braft#455 (#13)
Browse files Browse the repository at this point in the history
pick: baidu/braft#455

Co-authored-by: yangzining.yzn <[email protected]>
  • Loading branch information
ehds and yangzining.yzn authored Jun 10, 2024
1 parent f2bafea commit 1b5cbeb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/braft/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,21 @@ struct PeerId {
inline bool operator<(const PeerId& id1, const PeerId& id2) {
if (id1.addr < id2.addr) {
return true;
} else {
return id1.addr == id2.addr && id1.idx < id2.idx;
}
if (id2.addr < id1.addr) {
return false;
}
if (id1.idx < id2.idx) {
return true;
}
if (id2.idx < id1.idx) {
return false;
}
return id1.role < id2.role;
}

inline bool operator==(const PeerId& id1, const PeerId& id2) {
return (id1.addr == id2.addr && id1.idx == id2.idx);
return (id1.addr == id2.addr && id1.idx == id2.idx && id1.role == id2.role);
}

inline bool operator!=(const PeerId& id1, const PeerId& id2) {
Expand Down

0 comments on commit 1b5cbeb

Please sign in to comment.