Skip to content

Commit

Permalink
Merge pull request #65 from benbjohnson/fix-candidate-loop-state-check
Browse files Browse the repository at this point in the history
Fix state check in candidate inner loop.
  • Loading branch information
xiang90 committed Jul 10, 2013
2 parents da98ea0 + 2ee061c commit 8f030b5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ func (s *Server) candidateLoop() {
var err error
if e.target == &stopValue {
s.setState(Stopped)
break
} else if _, ok := e.target.(Command); ok {
err = NotLeaderError
} else if req, ok := e.target.(*AppendEntriesRequest); ok {
Expand All @@ -537,7 +536,7 @@ func (s *Server) candidateLoop() {

// both process AER and RVR can make the server to follower
// also break when timeout happens
if s.State() == Follower || timeout {
if s.State() != Candidate || timeout {
break
}
}
Expand Down

0 comments on commit 8f030b5

Please sign in to comment.