Improve p2p stream closing in http proxy

License: MIT
Signed-off-by: Ian Preston <ianopolous@protonmail.com>
This commit is contained in:
Dr Ian Preston 2018-10-03 22:49:11 +01:00 committed by Steven Allen
parent 6e24fc609a
commit d30c41a5e0

View File

@ -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()
}