about summary refs log tree commit homepage
path: root/lib/yahns/proxy_http_response.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-27 00:27:04 +0000
committerEric Wong <e@80x24.org>2016-04-27 00:29:52 +0000
commit5a74026b580cefeb95d75db40e1a55cd0be52751 (patch)
treeb2e82bbb74d28acea8081591511b66115e84cca1 /lib/yahns/proxy_http_response.rb
parent40873caf4a71a56332d32e7f4086bf49ca6e3916 (diff)
downloadyahns-5a74026b580cefeb95d75db40e1a55cd0be52751.tar.gz
We don't want to wait on GC to reap sockets on errors,
generational GC in Ruby is less aggressive about reaping
long-lived objects such as long-lived HTTP connections.
Diffstat (limited to 'lib/yahns/proxy_http_response.rb')
-rw-r--r--lib/yahns/proxy_http_response.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index 3462e40..c5e7be5 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -43,7 +43,12 @@ module Yahns::HttpResponse # :nodoc:
                      Rack::Utils::HTTP_STATUS_CODES[code]}\r\n\r\n") rescue nil
 
     shutdown rescue nil
-    req_res.shutdown rescue nil
+    @input = @input.close if @input
+
+    # this is safe ONLY because we are in an :ignore state after
+    # Fdmap#forget when we got hijacked:
+    close
+
     nil # signal close of req_res from yahns_step in yahns/proxy_pass.rb
   ensure
     wbuf.wbuf_abort if wbuf