Browse Source

consensus: fix race from OnStop accessing cs.Height

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

+ 3
- 0
consensus/state.go View File

@ -321,7 +321,10 @@ 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