Explorar el Código

raft: correct hasLeader

Blake Mizerany hace 11 años
padre
commit
75dce35a5d
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      raft2/raft.go

+ 1 - 1
raft2/raft.go

@@ -162,7 +162,7 @@ func newRaft(id int64, peers []int64) *raft {
 	return r
 }
 
-func (r *raft) hasLeader() bool { return r.state != stateCandidate }
+func (r *raft) hasLeader() bool { return r.lead != none }
 
 func (r *raft) propose(data []byte) {
 	r.Step(Message{From: r.id, Type: msgProp, Entries: []Entry{{Data: data}}})