aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasha Bubnov <girokompass@gmail.com>2016-11-28 23:16:16 +0300
committerBrad Fitzpatrick <bradfitz@golang.org>2017-06-26 18:31:26 +0000
commit03305a9e0c786dab67a373106a81df56dda21e25 (patch)
tree30b47dec4b79455e4236c5b3ba9ffd64ede0bdf6
parentb4dd1d965dfbbde6a46bddaf6f446f4426a04b2e (diff)
downloadgo-03305a9e0c786dab67a373106a81df56dda21e25.tar.gz
go-03305a9e0c786dab67a373106a81df56dda21e25.zip
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 <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/net/http/httptest/server.go2
1 files changed, 1 insertions, 1 deletions
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()