diff options
| author | Filippo Valsorda <hi@filippo.io> | 2017-02-17 11:57:46 -0500 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-04-24 22:20:51 +0000 |
| commit | 3fd976deca62debf355656772d3e9246102f5ad3 (patch) | |
| tree | 097a2ba89f4019cab7a8932a5a4f5a6c422d7086 | |
| parent | 39ce5907ca334fc5c10c6212a9a15f9225dc4877 (diff) | |
| download | go-3fd976deca62debf355656772d3e9246102f5ad3.tar.xz | |
net/http: document Shutdown/Serve return behavior
Change-Id: I9cdf6e7da0fb2d5194426eafa61812ea7a85f52f
Reviewed-on: https://go-review.googlesource.com/37161
Reviewed-by: Dan Peterson <dpiddy@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
| -rw-r--r-- | src/net/http/server.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go index f8398900c5..f29fa1272c 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2476,7 +2476,12 @@ var shutdownPollInterval = 500 * time.Millisecond // 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 returns the context's error, otherwise it returns any +// error returned from closing the Server's underlying Listener(s). +// +// When Shutdown is called, Serve, ListenAndServe, and +// ListenAndServeTLS immediately return ErrServerClosed. Make sure the +// program doesn't exit and waits instead for Shutdown to return. // // Shutdown does not attempt to close nor wait for hijacked // connections such as WebSockets. The caller of Shutdown should |
