https://golang.org/pkg/net/http/#Server.Shutdown

func (*Server) Shutdown
<https://golang.org/src/net/http/server.go?s=74304:74358#L2440>

func (srv *Server <https://golang.org/pkg/net/http/#Server>) Shutdown
<https://golang.org/pkg/net/http/#Shutdown>(ctx context
<https://golang.org/pkg/context/>.Context
<https://golang.org/pkg/context/#Context>) error
<https://golang.org/pkg/builtin/#error>

Shutdown gracefully shuts down the server without interrupting any active
connections. Shutdown works by first closing all open listeners, then
closing all idle connections, and then waiting indefinitely for connections
to return to idle and then shut down. If the provided context expires
before the shutdown is complete, then the context's error is returned.

Shutdown does not attempt to close nor wait for hijacked connections such
as WebSockets. The caller of Shutdown should separately notify such
long-lived connections of shutdown and wait for them to close, if desired.


On Fri, Mar 10, 2017 at 9:46 AM Andrew <angang....@gmail.com> wrote:

> Thanks Dave.
>
> According to your example, the server is shutdown immediately even in the
> middle of downloading a large file.
>
> I can use a timeout to close the connection. but is there some way to know
> we've finished serving all files before we close it?
>
> Andrew
>
> --
> 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.
>

-- 
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