From 03305a9e0c786dab67a373106a81df56dda21e25 Mon Sep 17 00:00:00 2001 From: Yasha Bubnov Date: Mon, 28 Nov 2016 23:16:16 +0300 Subject: [PATCH] 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 --- src/net/http/httptest/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() -- 2.50.0