Commit 03305a9e authored by Yasha Bubnov's avatar Yasha Bubnov Committed by Brad Fitzpatrick

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/33614Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent b4dd1d96
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment