From 026219a98c0ecf919c3ecce32ba389254a571795 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Nov 2009 20:13:34 -0800 Subject: rev: DeferredResponse: always attach to main loop It's too complicated to deal with multiple Rev loops so only use the main one for now under 1.9. --- lib/rainbows/rev/deferred_response.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rainbows/rev/deferred_response.rb b/lib/rainbows/rev/deferred_response.rb index abf3514..9c3c27f 100644 --- a/lib/rainbows/rev/deferred_response.rb +++ b/lib/rainbows/rev/deferred_response.rb @@ -10,6 +10,10 @@ module Rainbows G = Rainbows::G HH = Rack::Utils::HeaderHash + # we only want to attach to the Rev::Loop belonging to the + # main thread in Ruby 1.9 + LOOP = ::Rev::Loop.default + def self.defer!(client, response, out) body = response.last headers = HH.new(response[1]) @@ -32,7 +36,7 @@ module Rainbows out[0] = CONN_CLOSE end - io = new(io, client, do_chunk, body).attach(::Rev::Loop.default) + io = new(io, client, do_chunk, body).attach(LOOP) elsif st.file? headers.delete('Transfer-Encoding') headers['Content-Length'] ||= st.size.to_s -- cgit v1.2.3-24-ge0c7