Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
ignore vote response with lower term
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzh committed Jul 24, 2019
1 parent bbd1524 commit 890cadd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -28,6 +28,7 @@ script:
- pytest -vs test_control.py
- pytest -vs test_membership.py
- pytest -vs test_sync_log.py
- pytest -vs . ; exit 0
env:
- BUILD_TYPE=DEBUG
- BUILD_TYPE=RELEASE
Expand Down
1 change: 1 addition & 0 deletions src/core/Instance.cpp
Expand Up @@ -161,6 +161,7 @@ void Instance::on_rpc(const string &, shared_ptr<Message> message) {
}
} else if (role == CANDIDATE) {
if (auto res_vote = dynamic_pointer_cast<RequestVoteReply>(message)) {
if (res_vote->term() < current_term) return;
if (res_vote->votegranted()) {
auto from = res_vote->from();
if (!voted_for_self[from]) {
Expand Down

0 comments on commit 890cadd

Please sign in to comment.