summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-23 20:39:13 +0300
committerWolfy-J <[email protected]>2018-06-23 20:39:13 +0300
commit18201f5f6af71fad14bbfc93eec1654b2f8fa585 (patch)
tree36cfe76e67998f414d7efb00f1a7c030bbfbcfad
parenta47fdb8b8c93a8e2c9af1d786e746b145f4b16ed (diff)
custom version
-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 {