From d30c41a5e04ecca3603fc8b7d18e3260dab54f10 Mon Sep 17 00:00:00 2001 From: Dr Ian Preston Date: Wed, 3 Oct 2018 22:49:11 +0100 Subject: [PATCH] Improve p2p stream closing in http proxy License: MIT Signed-off-by: Ian Preston --- core/corehttp/proxy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/corehttp/proxy.go b/core/corehttp/proxy.go index b92cb341d..5d1874471 100644 --- a/core/corehttp/proxy.go +++ b/core/corehttp/proxy.go @@ -95,7 +95,11 @@ type respBody struct { // Closes the response's body and the connection. func (rb *respBody) Close() error { - rb.stream.Close() + if err := rb.stream.Close(); err != nil { + rb.stream.Reset() + } else { + go inet.AwaitEOF(rb.stream) + } return rb.ReadCloser.Close() }