From: Yasha Bubnov Date: Mon, 28 Nov 2016 20:16:16 +0000 (+0300) Subject: net/http/httptest: close client connections in separate goroutines X-Git-Tag: go1.9beta2~4 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=03305a9e0c786dab67a373106a81df56dda21e25;p=gostls13.git net/http/httptest: close client connections in separate goroutines The existing implementation sequentially closes connection in the loop and until the previous client connections is not closed the next one would not be processed. Instead, the algorithm modified to spawn the function that closes single connection in a standalone goroutine, thus making at least a try to close it. Change-Id: Ib96b5b477f841926450d122b67f14f1a2da36ee1 Reviewed-on: https://go-review.googlesource.com/33614 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/net/http/httptest/server.go b/src/net/http/httptest/server.go index 549ef04623..1baec23d57 100644 --- a/src/net/http/httptest/server.go +++ b/src/net/http/httptest/server.go @@ -235,7 +235,7 @@ func (s *Server) CloseClientConnections() { nconn := len(s.conns) ch := make(chan struct{}, nconn) for c := range s.conns { - s.closeConnChan(c, ch) + go s.closeConnChan(c, ch) } s.mu.Unlock()