about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-05 22:48:44 +0000
committerEric Wong <e@80x24.org>2016-06-05 22:48:44 +0000
commit5e211ea003d20708a221d124e139f72ded4e18b0 (patch)
tree392185e2eb42888853fc016711a19d452542e46f /lib
parentdcdeb4071ded73bcf4fd696b268bce7ee2021f5d (diff)
downloadyahns-5e211ea003d20708a221d124e139f72ded4e18b0.tar.gz
@busy will be reset on wbuf_write anyways, since there is no
initial data and we will always attempt to write to the socket
aggressively.
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/http_response.rb8
-rw-r--r--lib/yahns/proxy_http_response.rb8
-rw-r--r--lib/yahns/wbuf.rb4
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 4b36db2..531194f 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -57,12 +57,12 @@ module Yahns::HttpResponse # :nodoc:
     "#{response_start}#{code} #{Rack::Utils::HTTP_STATUS_CODES[code]}\r\n\r\n"
   end
 
-  def response_header_blocked(ret, header, body, alive, offset, count)
+  def response_header_blocked(header, body, alive, offset, count)
     if body.respond_to?(:to_path)
       alive = Yahns::StreamFile.new(body, alive, offset, count)
       body = nil
     end
-    wbuf = Yahns::Wbuf.new(body, alive, self.class.output_buffer_tmpdir, ret)
+    wbuf = Yahns::Wbuf.new(body, alive, self.class.output_buffer_tmpdir)
     rv = wbuf.wbuf_write(self, header)
     if body && ! alive.respond_to?(:call) # skip body.each if hijacked
       body.each { |chunk| rv = wbuf.wbuf_write(self, chunk) }
@@ -171,7 +171,7 @@ module Yahns::HttpResponse # :nodoc:
       when :wait_writable, :wait_readable # unlikely
         if k.output_buffering
           alive = hijack ? hijack : alive
-          rv = response_header_blocked(rv, buf, body, alive, offset, count)
+          rv = response_header_blocked(buf, body, alive, offset, count)
           body = nil # ensure we do not close body in ensure
           return rv
         else
@@ -199,7 +199,7 @@ module Yahns::HttpResponse # :nodoc:
           chunk = rv # hope the skb grows when we loop into the trywrite
         when :wait_writable, :wait_readable
           if k.output_buffering
-            wbuf = Yahns::Wbuf.new(body, alive, k.output_buffer_tmpdir, rv)
+            wbuf = Yahns::Wbuf.new(body, alive, k.output_buffer_tmpdir)
             rv = wbuf.wbuf_write(self, chunk)
             break
           else
diff --git a/lib/yahns/proxy_http_response.rb b/lib/yahns/proxy_http_response.rb
index ea176d9..61f1539 100644
--- a/lib/yahns/proxy_http_response.rb
+++ b/lib/yahns/proxy_http_response.rb
@@ -19,9 +19,9 @@ module Yahns::HttpResponse # :nodoc:
     :ignore
   end
 
-  def wbuf_alloc(req_res, busy)
+  def wbuf_alloc(req_res)
     if req_res.proxy_pass.proxy_buffering
-      Yahns::Wbuf.new(nil, req_res.alive, self.class.output_buffer_tmpdir, busy)
+      Yahns::Wbuf.new(nil, req_res.alive, self.class.output_buffer_tmpdir)
     else
       Yahns::WbufLite.new(req_res)
     end
@@ -37,7 +37,7 @@ module Yahns::HttpResponse # :nodoc:
       when String, Array # partial write, hope the skb grows
         buf = rv
       when :wait_writable, :wait_readable
-        wbuf = req_res.resbuf ||= wbuf_alloc(req_res, rv)
+        wbuf = req_res.resbuf ||= wbuf_alloc(req_res)
         break
       end while true
     end
@@ -75,7 +75,7 @@ module Yahns::HttpResponse # :nodoc:
   end
 
   def wait_on_upstream(req_res)
-    req_res.resbuf ||= wbuf_alloc(req_res, false)
+    req_res.resbuf ||= wbuf_alloc(req_res)
     :wait_readable # self remains in :ignore, wait on upstream
   end
 
diff --git a/lib/yahns/wbuf.rb b/lib/yahns/wbuf.rb
index f7b2ffa..1010c86 100644
--- a/lib/yahns/wbuf.rb
+++ b/lib/yahns/wbuf.rb
@@ -32,13 +32,13 @@ class Yahns::Wbuf # :nodoc:
   include Yahns::WbufCommon
   attr_reader :busy
 
-  def initialize(body, persist, tmpdir, busy)
+  def initialize(body, persist, tmpdir)
     @tmpio = nil
     @tmpdir = tmpdir
     @sf_offset = @sf_count = 0
     @wbuf_persist = persist # whether or not we keep the connection alive
     @body = body # something we call #close on when done writing
-    @busy = busy # may be false
+    @busy = false
   end
 
   def wbuf_writev(buf)