]> Cypherpunks repositories - gostls13.git/commit
net/http: ensure ConnState for StateNew fires before Server.Serve returns
authorRichard Crowley <r@rcrowley.org>
Sun, 2 Mar 2014 04:32:42 +0000 (20:32 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 2 Mar 2014 04:32:42 +0000 (20:32 -0800)
commit7124ee59d18fabe5494227b19250b4040a4aa8b6
treed8406c39aa93a9ec7ac9c7db10c4fa4b38c02f00
parent9f0bba45f462f5e0c5a7d7e080f80fae1c4a1d8d
net/http: ensure ConnState for StateNew fires before Server.Serve returns

The addition of Server.ConnState provides all the necessary
hooks to stop a Server gracefully, but StateNew previously
could fire concurrently with Serve exiting (as it does when
its net.Listener is closed). This previously meant one
couldn't use a WaitGroup incremented in the StateNew hook
along with calling Wait after Serve. Now you can.

Update #4674

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/70410044
src/pkg/net/http/serve_test.go
src/pkg/net/http/server.go