ソースを参照

raft: move tick comments into cases

Blake Mizerany 11 年 前
コミット
dd94d5d4e8
1 ファイル変更2 行追加3 行削除
  1. 2 3
      raft/node.go

+ 2 - 3
raft/node.go

@@ -66,13 +66,12 @@ func (n *Node) Step(m Message) bool {
 		return false
 	}
 	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 {
 		case msgAppResp:
+			// We just heard from the leader of the same term.
 			n.elapsed = 0
 		case msgVoteResp:
+			// We just heard from the candidate the node voted for.
 			if m.Index >= 0 {
 				n.elapsed = 0
 			}