Improve p2p stream closing in http proxy
License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
Dr Ian Preston committed
Oct 3, 2018 at 22:49 UTC
d30c41a5e04ecca3603fc8b7d18e3260dab54f10
1 file changed
+5
-1
core/corehttp/proxy.go
+5
-1
@@ -95,7 +95,11 @@ type respBody struct {
95
96
// Closes the response's body and the connection.
97
func (rb *respBody) Close() error {
98
- rb.stream.Close()
98
+ if err := rb.stream.Close(); err != nil {
99
+ rb.stream.Reset()
100
+ } else {
101
+ go inet.AwaitEOF(rb.stream)
102
+ }
103
return rb.ReadCloser.Close()
104
}
105