Yes! That works :-) Thanks so much.

So apparently we cannot call *net.http.Server.Shutdown()* from a handler 
function. Maybe this should be added to the docs.

On Monday, July 10, 2017 at 3:05:10 PM UTC+10, mikioh...@gmail.com wrote:
>
> 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.

Reply via email to