diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-25 09:28:22 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-26 09:23:49 +0000 |
commit | 052e2b3608071d9cd9d6b1d12f8cb69ac29124af (patch) | |
tree | d1c72552fd8ccc7dd5d3ad3a4dd76fbf68ebea72 /lib/rainbows/rev/thread.rb | |
parent | 84ac2eaa8bd16e44420abf660420698f76ad5473 (diff) | |
download | rainbows-052e2b3608071d9cd9d6b1d12f8cb69ac29124af.tar.gz |
With sendfile enabled, we must avoid writing headers (or normal, non-file responses) while a file is deferred for sending. This means we must disable processing of new requests while a file is deferred for sending and use the on_write_complete callback less aggressively.
Diffstat (limited to 'lib/rainbows/rev/thread.rb')
-rw-r--r-- | lib/rainbows/rev/thread.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/rainbows/rev/thread.rb b/lib/rainbows/rev/thread.rb index 2dbaa84..cce3e92 100644 --- a/lib/rainbows/rev/thread.rb +++ b/lib/rainbows/rev/thread.rb @@ -13,28 +13,20 @@ module Rainbows def app_call KATO.delete(self) - disable + disable if enabled? @env[RACK_INPUT] = @input app_dispatch # must be implemented by subclass end # this is only called in the master thread def response_write(response) - enable alive = @hp.keepalive? && G.alive rev_write_response(response, alive) - return quit unless alive + return quit unless alive && :close != @state @env.clear @hp.reset @state = :headers - # keepalive requests are always body-less, so @input is unchanged - if @hp.headers(@env, @buf) - @input = HttpRequest::NULL_IO - app_call - else - KATO[self] = Time.now - end end # fails-safe application dispatch, we absolutely cannot |