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:
parent
a01636a1b0
commit
a954821b98
1 changed files with 4 additions and 2 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue