Skip to content

Commit

Permalink
fix race bug (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Jul 30, 2021
1 parent b76268c commit a42ecad
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions consensus/vbft/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ func (self *Server) initialize() error {
go self.syncer.run()
go self.stateMgr.run()
go self.msgSendLoop()
go self.timerLoop()
go self.actionLoop()
go func() {
self.quitWg.Add(1)
Expand Down Expand Up @@ -1660,26 +1659,13 @@ func (self *Server) actionLoop() {
}
}

case <-self.quitC:
log.Infof("server %d actionLoop quit", self.Index)
return
}
}
}

func (self *Server) timerLoop() {
self.quitWg.Add(1)
defer self.quitWg.Done()

for {
select {
case evt := <-self.timer.C:
if err := self.processTimerEvent(evt); err != nil {
log.Errorf("failed to process timer evt: %d, err: %s", evt.evtType, err)
}

case <-self.quitC:
log.Infof("server %d timerLoop quit", self.Index)
log.Infof("server %d actionLoop quit", self.Index)
return
}
}
Expand Down

0 comments on commit a42ecad

Please sign in to comment.