Commit 04e2e81e authored by Patrik Lundin's avatar Patrik Lundin Committed by Emmanuel Odeke

net/http: stop ExampleServer_Shutdown from hanging on error

Running the example code when not having permissions
to bind to port 80 will cause the program to hang after
printing the error message.

Change-Id: I2433ba2629b362fc8f1731e40cab5eea72ec354f
GitHub-Last-Rev: 0bb3dc08b6f646470fc6ff208ea12bca901a2299
GitHub-Pull-Request: golang/go#32947
Reviewed-on: https://go-review.googlesource.com/c/go/+/185157Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent adcb2b1e
......@@ -132,7 +132,7 @@ func ExampleServer_Shutdown() {
if err := srv.ListenAndServe(); err != http.ErrServerClosed {
// Error starting or closing listener:
log.Printf("HTTP server ListenAndServe: %v", err)
log.Fatalf("HTTP server ListenAndServe: %v", err)
}
<-idleConnsClosed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment