Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Willemt Raft
Commits
bd54c09b
Commit
bd54c09b
authored
May 20, 2016
by
Willem Thiart
Browse files
Fix: non-voting nodes cannot vote
parent
218ca951
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/raft_server.c
View file @
bd54c09b
...
...
@@ -454,6 +454,14 @@ int raft_already_voted(raft_server_t* me_)
static
int
__should_grant_vote
(
raft_server_private_t
*
me
,
msg_requestvote_t
*
vr
)
{
/* TODO: 4.2.3 Raft Dissertation:
* if a server receives a RequestVote request within the minimum election
* timeout of hearing from a current leader, it does not update its term or
* grant its vote */
if
(
!
raft_node_is_voting
(
raft_get_my_node
((
void
*
)
me
)))
return
0
;
if
(
vr
->
term
<
raft_get_current_term
((
void
*
)
me
))
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment