about summary refs log tree commit homepage
path: root/lib/rainbows/rev/client.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-18 00:08:23 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-18 00:08:23 -0800
commit9ab648f027d25b90fb2e7011fcd92091f19e7b02 (patch)
treebf5c5d354687b2fd1c621be58a3d097e529ba5f3 /lib/rainbows/rev/client.rb
parentc71773184633402e2a47ea6c3bc6be639cddc744 (diff)
downloadrainbows-9ab648f027d25b90fb2e7011fcd92091f19e7b02.tar.gz
This is a bit trickier than the rest since we have to ensure
deferred (proxied) responses aren't nuked.
Diffstat (limited to 'lib/rainbows/rev/client.rb')
-rw-r--r--lib/rainbows/rev/client.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb
index 9decac9..b30bd0e 100644
--- a/lib/rainbows/rev/client.rb
+++ b/lib/rainbows/rev/client.rb
@@ -23,8 +23,13 @@ module Rainbows
         schedule_write unless out_headers # triggers a write
       end
 
+      def timeout?
+        @_write_buffer.empty? && @deferred_bodies.empty? and close.nil?
+      end
+
       def app_call
         begin
+          KATO.delete(self)
           (@env[RACK_INPUT] = @input).rewind
           @env[REMOTE_ADDR] = @remote_addr
           response = APP.call(@env.update(RACK_DEFAULTS))
@@ -38,6 +43,7 @@ module Rainbows
             @state = :headers
             # keepalive requests are always body-less, so @input is unchanged
             @hp.headers(@env, @buf) and next
+            KATO[self] = Time.now
           else
             quit
           end