Github user anmolnar commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/546#discussion_r197485176
--- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
---
@@ -2069,4 +2073,9 @@ public QuorumCnxManager createCnxnManager() {
this.quorumCnxnThreadsSize,
this.isQuorumSaslAuthEnabled());
}
+
+ boolean isLeader(long id) {
+ Vote vote = getCurrentVote();
+ return vote != null && id == vote.getId();
--- End diff --
I think it would be good to add unit test to verify this logic too.
---