mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: move tick comments into cases
This commit is contained in:
parent
15a8b46359
commit
dd94d5d4e8
@ -66,13 +66,12 @@ func (n *Node) Step(m Message) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for _, m := range n.sm.msgs[l:] {
|
for _, m := range n.sm.msgs[l:] {
|
||||||
// reset elapsed in two cases:
|
|
||||||
// msgAppResp -> heard from the leader of the same term
|
|
||||||
// msgVoteResp with grant -> heard from the candidate the node voted for
|
|
||||||
switch m.Type {
|
switch m.Type {
|
||||||
case msgAppResp:
|
case msgAppResp:
|
||||||
|
// We just heard from the leader of the same term.
|
||||||
n.elapsed = 0
|
n.elapsed = 0
|
||||||
case msgVoteResp:
|
case msgVoteResp:
|
||||||
|
// We just heard from the candidate the node voted for.
|
||||||
if m.Index >= 0 {
|
if m.Index >= 0 {
|
||||||
n.elapsed = 0
|
n.elapsed = 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user