calling Shutdown method of http.Server in a registered HTTP handler probably may prevent the package internal helpers from marking the inflight connection idle. so you can write like the following:
http.HandleFunc("/stop", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "shutdown request accepted") go func() { log.Println("shutting down the server: "srv.Shutdown(context.Background()) close(done) }() }) see https://golang.org/pkg/net/http/#Server.Shutdown for further information. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.