]> Cypherpunks repositories - gostls13.git/commit
net/http: Release reference to chunkWriter's bufio.Writer on hijack
authorJohn Newlin <jnewlin@google.com>
Thu, 26 Dec 2013 19:52:14 +0000 (11:52 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 26 Dec 2013 19:52:14 +0000 (11:52 -0800)
commit92b5e16147b26dcea216b48b380566b900b4916b
tree1df1496bb584212d2df098d0a2b2332582052904
parent499d2167fc8ae6fde73e78ed31f3762683fd29a2
net/http: Release reference to chunkWriter's bufio.Writer on hijack

When a connection is hijacked, release the reference to the bufio.Writer
that is used with the chunkWriter.  The chunkWriter is not used after
the connection is hijacked.

Also add a test to check that double Hijack calls do something sensible.

benchmark                old ns/op    new ns/op    delta
BenchmarkServerHijack        24137        20629  -14.53%

benchmark               old allocs   new allocs    delta
BenchmarkServerHijack           21           19   -9.52%

benchmark                old bytes    new bytes    delta
BenchmarkServerHijack        11774         9667  -17.90%

R=bradfitz, dave, chris.cahoon
CC=golang-codereviews
https://golang.org/cl/39440044
src/pkg/net/http/serve_test.go
src/pkg/net/http/server.go