From 48e8c2d4f02d5f28344dcf7e40b45c346f492e2b Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 7 Jul 2025 07:53:01 -0400 Subject: [PATCH] cmd/stepd: Don't copy lock value --- cmd/stepd/main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/stepd/main.go b/cmd/stepd/main.go index f291651..bf36fba 100644 --- a/cmd/stepd/main.go +++ b/cmd/stepd/main.go @@ -209,8 +209,10 @@ func main () { // set up the HTTP server httpServer := httpServerRoutine { - Addr: config.Get("http.address"), - Handler: &handler, + Server: &http.Server { + Addr: config.Get("http.address"), + Handler: &handler, + }, } // set up the trimming routine @@ -241,21 +243,22 @@ func main () { } } -type httpServerRoutine http.Server +type httpServerRoutine struct { + *http.Server +} func (this *httpServerRoutine) Run (ctx context.Context) error { ctx, done := context.WithCancel(ctx) defer done() - server := http.Server(*this) go func () { <- ctx.Done() shutdownCtx, done := context.WithTimeout ( context.Background(), 16 * time.Second) defer done() - server.Shutdown(shutdownCtx) + this.Server.Shutdown(shutdownCtx) } () - err := server.ListenAndServe() + err := this.Server.ListenAndServe() if ctx.Err() != nil { return ctx.Err() }