From cce1197484923c97b982892136e04d34f899b5f2 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 20 Jan 2018 09:30:47 -0800 Subject: [PATCH] cmd/routed: signal shutdown better --- cmd/routed/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/routed/main.go b/cmd/routed/main.go index 4e19061..153dc11 100644 --- a/cmd/routed/main.go +++ b/cmd/routed/main.go @@ -68,7 +68,7 @@ func main() { signal.Notify(ch, os.Interrupt) - time.Sleep(30 * time.Second) + <-ctx.Done() wg.Wait() } @@ -91,6 +91,7 @@ func setupHTTP(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config) for { select { case <-ctx.Done(): + ln.Log(ctx, ln.F{"kind": "http"}, ln.Action("shutdown signal recieved")) hs.SetKeepAlivesEnabled(false) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) @@ -125,6 +126,7 @@ func setupQuic(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config) for { select { case <-ctx.Done(): + ln.Log(ctx, ln.F{"kind": "quic"}, ln.Action("shutdown signal recieved")) qs.SetKeepAlivesEnabled(false) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) @@ -155,6 +157,7 @@ func setupTLS(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config) { for { select { case <-ctx.Done(): + ln.Log(ctx, ln.F{"kind": "https"}, ln.Action("shutdown signal recieved")) hs.SetKeepAlivesEnabled(false) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)