From 52fcfd71e66a6a81df5fcb273051512b6ac5702d Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 26 Dec 2016 07:54:51 +0100 Subject: [PATCH] Revert "Close http connection ASAP." This reverts commit 56f08afd9cd3c983ed856cda089ca796b166513c. --- proxy/http/server.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/proxy/http/server.go b/proxy/http/server.go index dbbea0ab..7ced64fc 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -239,11 +239,12 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn StripHopByHopHeaders(request) ray := v.packetDispatcher.DispatchToOutbound(session) + defer ray.InboundInput().Close() + defer ray.InboundOutput().Release() var finish sync.WaitGroup finish.Add(1) go func() { - defer ray.InboundInput().Close() defer finish.Done() requestWriter := bufio.NewWriter(buf.NewBytesWriter(ray.InboundInput())) err := request.Write(requestWriter) @@ -256,7 +257,6 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn finish.Add(1) go func() { - defer ray.InboundOutput().Release() defer finish.Done() responseReader := bufio.OriginalReader(buf.NewBytesReader(ray.InboundOutput())) response, err := http.ReadResponse(responseReader, request) @@ -272,7 +272,6 @@ func (v *Server) handlePlainHTTP(request *http.Request, session *proxy.SessionIn } responseWriter.Flush() }() - finish.Wait() }