consensus: make Shutdown a no-op if not started

It makes client code a bit simpler, we can just issue a Shutdown() request
without thinking much about it (but only once of course).
This commit is contained in:
Roman Khimov 2021-04-02 12:50:46 +03:00
parent a01636a1b0
commit a954821b98

View file

@ -252,8 +252,10 @@ func (s *service) Start() {
// Shutdown implements Service interface.
func (s *service) Shutdown() {
close(s.quit)
<-s.finished
if s.started.Load() {
close(s.quit)
<-s.finished
}
}
func (s *service) eventLoop() {