summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/rr/cmd/serve.go1
-rw-r--r--service/http/service.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/cmd/rr/cmd/serve.go b/cmd/rr/cmd/serve.go
index dc751611..664baf15 100644
--- a/cmd/rr/cmd/serve.go
+++ b/cmd/rr/cmd/serve.go
@@ -44,6 +44,7 @@ func serveHandler(cmd *cobra.Command, args []string) error {
Container.Serve()
stopSignal <- nil
}()
+
<-stopSignal
Container.Stop()
diff --git a/service/http/service.go b/service/http/service.go
index f171e48e..cef019b3 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -97,6 +97,11 @@ func (s *Service) Serve() error {
// Stop stops the svc.
func (s *Service) Stop() {
+ if atomic.LoadInt32(&s.stopping) != 0 {
+ // already stopping
+ return
+ }
+
s.mu.Lock()
defer s.mu.Unlock()
if s.http == nil {