Browse Source

consensus: don't print shared vars in cs.String()

pull/233/head
Ethan Buchman 8 years ago
parent
commit
f44336d57d
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      consensus/state.go

+ 2
- 3
consensus/state.go View File

@ -268,7 +268,8 @@ func (cs *ConsensusState) SetEventSwitch(evsw *events.EventSwitch) {
}
func (cs *ConsensusState) String() string {
return Fmt("ConsensusState(H:%v R:%v S:%v", cs.Height, cs.Round, cs.Step)
// better not to access shared variables
return Fmt("ConsensusState") //(H:%v R:%v S:%v", cs.Height, cs.Round, cs.Step)
}
func (cs *ConsensusState) GetState() *sm.State {
@ -321,9 +322,7 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
}
func (cs *ConsensusState) OnStop() {
cs.mtx.Lock() // NOTE: OnStop prints the cs.Height, which might be concurrently updated ...
cs.QuitService.OnStop()
cs.mtx.Unlock()
if cs.wal != nil && cs.IsRunning() {
cs.wal.Wait()


Loading…
Cancel
Save