@cryptotaxi247 / kubo / commits / 5367ee76d

fix another panic where CloseNotify was called from wrong goroutine

panic: net/http: CloseNotify called after ServeHTTP finished goroutine 180 [running]: net/http.(*response).CloseNotify(0xc8220684e0, 0x0) /home/r/go/src/net/http/server.go:1535 +0x9d github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prometheus/client_golang/ /home/r/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prome github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandler.func1(0x7 /home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:119 + created by github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandle /home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:123 + License: MIT Signed-off-by: Robert Carlsen <rwcarlsen@gmail.com>

Robert Carlsen committed Feb 9, 2016 at 11:09 UTC 5367ee76d0390ca7d12c5355cea7a8343385f5df
1 file changed +2 -1
core/corehttp/gateway_handler.go
+2 -1
@@ -114,9 +114,10 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
114 defer cancel()
115
116 if cn, ok := w.(http.CloseNotifier); ok {
117 + clientGone := cn.CloseNotify()
118 go func() {
119 select {
119 - case <-cn.CloseNotify():
120 + case <-clientGone:
121 case <-ctx.Done():
122 }
123 cancel()