forked from cowsql/raft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recv: Check remote term early on when handling RequestVote responses
When handling a RequestVote response, immediately check the term of the remote peer, before doing anything else. This avoids checking if we are in candidate state twice, once at the beginning of the message handling and once after the term check, to handle the case where we step down. Also, decide whether to perform an actual term bump or just a check based on the pre-vote flag of the RequestVote response being handled, and not based on whether we are in pre-vote phase or not. That's because we always want to bump our term if for any reason we discover an higher term (e.g. we receive a delayed non pre-vote response containing a newer term while in the meantime we have transitioned to pre-vote phase). Signed-off-by: Free Ekanayaka <free@ekanayaka.io>
- Loading branch information
1 parent
fd63a69
commit df9cd47
Showing
2 changed files
with
15 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters