]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: Clean up ReverseProxy maxLatencyWriter goroutines.
authorColby Ranger <cranger@google.com>
Wed, 18 Apr 2012 18:33:02 +0000 (11:33 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 18 Apr 2012 18:33:02 +0000 (11:33 -0700)
commit5694ebf057889444e8bbe97741004c4ecdcb7785
tree35fea93af2dc220d9320562d2bc9cd2d4c657f62
parent6742d0a085021d9638a4d59dd8fb562aec8d51a8
net/http/httputil: Clean up ReverseProxy maxLatencyWriter goroutines.

When FlushInterval is specified on ReverseProxy, the ResponseWriter is
wrapped with a maxLatencyWriter that periodically flushes in a
goroutine. That goroutine was not being cleaned up at the end of the
request. This resulted in a panic when Flush() was being called on a
ResponseWriter that was closed.

The code was updated to always send the done message to the flushLoop()
goroutine after copying the body. Futhermore, the code was refactored to
allow the test to verify the maxLatencyWriter behavior.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6033043
src/pkg/net/http/httputil/reverseproxy.go
src/pkg/net/http/httputil/reverseproxy_test.go