func (s *State) StepDown(term int) {
	s.mu.Lock()
	defer s.mu.Unlock()
	s.term = term
	s.votedFor = NoVote
	if s.state != StateFollower {
		s.state = StateFollower
		go func() {
			s.stateChangeChan <- StateFollower
		}()
	}
}
// StepDown will step down the state by resetting to the given term
// and emitting a state change.
StepDown will step down the state by resetting to the given term
and emitting a state change.
// StepDown will step down the state by resetting to the given term // and emitting a state change .
func (s *State) StepDown(term int) {
	s.mu.Lock()
	defer s.mu.Unlock()
	s.term = term
	s.votedFor = NoVote
	if s.state != StateFollower {
		s.state = StateFollower
		go func() {
			s.stateChangeChan <- StateFollower
		}()
	}
}
func ( s * State ) StepDown ( term int ) { s . mu . Lock ( ) defer s . mu . Unlock ( ) s . term = term s . votedFor = NoVote if s . state != StateFollower { s . state = StateFollower go func ( ) { s . stateChangeChan <- StateFollower } ( ) } }
StepDown will step down the state by resetting to the given term
and emitting a state change.
StepDown will step down the state by resetting to the given term and emitting a state change .