From 60900208616ee5b41716b23215a0fce33bc3eb5a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Nov 2009 01:26:04 -0800 Subject: rev/event_machine: simplify keepalive checking a bit Since the HTTP parser is frozen during app dispatch, there's no point in checking for HTTP keepalive sooner. Of course we check G.alive as late as possible since we could've received a :QUIT signal while app.call was running. --- lib/rainbows/event_machine.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/rainbows/event_machine.rb') diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb index 5c25ade..7f77428 100644 --- a/lib/rainbows/event_machine.rb +++ b/lib/rainbows/event_machine.rb @@ -53,7 +53,6 @@ module Rainbows def app_call begin (@env[RACK_INPUT] = @input).rewind - alive = @hp.keepalive? @env[REMOTE_ADDR] = @remote_addr @env[ASYNC_CALLBACK] = method(:response_write) @@ -64,7 +63,7 @@ module Rainbows # long-running async response (response.nil? || -1 == response.first) and return @state = :close - alive &&= G.alive + alive = @hp.keepalive? && G.alive out = [ alive ? CONN_ALIVE : CONN_CLOSE ] if @hp.headers? response_write(response, out, alive) -- cgit v1.2.3-24-ge0c7