mirror of
https://github.com/golang/go
synced 2024-11-12 05:30:21 -07:00
net/http/httptest: protect against port reuse
Should make BSDs more reliable. (they seem to reuse ports quicker than Linux) Tested by hand with local modifications to force reuse on Linux. (net/http tests failed before, pass now) Details in the issue. Fixes #4436 R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/6847101
This commit is contained in:
parent
c8fa7dcc25
commit
f97bb12bb0
@ -155,6 +155,10 @@ func NewTLSServer(handler http.Handler) *Server {
|
||||
func (s *Server) Close() {
|
||||
s.Listener.Close()
|
||||
s.wg.Wait()
|
||||
s.CloseClientConnections()
|
||||
if t, ok := http.DefaultTransport.(*http.Transport); ok {
|
||||
t.CloseIdleConnections()
|
||||
}
|
||||
}
|
||||
|
||||
// CloseClientConnections closes any currently open HTTP connections
|
||||
|
Loading…
Reference in New Issue
Block a user