raft: fix pendingConf

This commit is contained in:
Xiang Li 2014-06-09 16:56:04 -07:00 committed by Yicheng Qin
parent c03fbf68d6
commit d293c4915c

View File

@ -203,6 +203,7 @@ func (sm *stateMachine) becomeFollower(term, lead int) {
sm.term = term
sm.lead = lead
sm.state = stateFollower
sm.pendingConf = false
}
func (sm *stateMachine) becomeCandidate() {
@ -224,6 +225,12 @@ func (sm *stateMachine) becomeLeader() {
sm.reset()
sm.lead = sm.addr
sm.state = stateLeader
for _, e := range sm.log.ents[sm.log.committed:] {
if e.Type == config {
sm.pendingConf = true
}
}
}
func (sm *stateMachine) Msgs() []Message {