From 7e4a7225dbd01df27a6b3ec44e53c013b889a724 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 7 Jan 2011 16:12:26 -0800 Subject: event_machine: cleanup async logic Since we support keepalive now, setting @state can be harmful and the comment is out-of-date. --- lib/rainbows/event_machine/client.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/rainbows/event_machine') diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb index 22e5360..ff77d2b 100644 --- a/lib/rainbows/event_machine/client.rb +++ b/lib/rainbows/event_machine/client.rb @@ -39,16 +39,12 @@ class Rainbows::EventMachine::Client < EM::Connection @env[REMOTE_ADDR] = @_io.kgio_addr @env[ASYNC_CALLBACK] = method(:write_async_response) @env[ASYNC_CLOSE] = EM::DefaultDeferrable.new - status, headers, body = catch(:async) { APP.call(@env.merge!(RACK_DEFAULTS)) } - # too tricky to support pipelining with :async since the - # second (pipelined) request could be a stuck behind a - # long-running async response - (status.nil? || -1 == status) and return @state = :close - write_response(status, headers, body, @hp.next?) + (nil == status || -1 == status) or + write_response(status, headers, body, @hp.next?) end def next! -- cgit v1.2.3-24-ge0c7