From 979ae0fbad5b9a8cfbe0d09fc6024aad47e40a0b Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Mon, 11 Jan 2021 22:45:01 +0100 Subject: [PATCH] (*Server).Stop gets the context now from the calling function --- http.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/http.go b/http.go index dcd53ec..a9677a1 100644 --- a/http.go +++ b/http.go @@ -4,7 +4,6 @@ import ( "context" "crypto/tls" "net/http" - "time" "github.com/gin-gonic/gin" "github.com/pelletier/go-toml" @@ -94,8 +93,7 @@ func (s *Server) UseAuthBackend(a auth.AuthenticationHandler) { } // Stop Shuts the Server down -func (s *Server) Stop() { - ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(time.Second*5)) +func (s *Server) Stop(ctx context.Context) { go func() { log.Info().Err(s.http.Shutdown(ctx)).Msg("Server Shut down.") }()