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,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:
|
||||||
|
|
Loading…
Reference in a new issue