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,9 +252,11 @@ func (s *service) Start() {
// Shutdown implements Service interface. // Shutdown implements Service interface.
func (s *service) Shutdown() { func (s *service) Shutdown() {
if s.started.Load() {
close(s.quit) close(s.quit)
<-s.finished <-s.finished
} }
}
func (s *service) eventLoop() { func (s *service) eventLoop() {
events: events: