about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-07 20:13:34 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-07 20:13:34 -0800
commit026219a98c0ecf919c3ecce32ba389254a571795 (patch)
tree35efc11b9243aa375987936a6b3488c6cfbabb4e
parent7d07c36f1da30af054d78deed5e87f29832d6f6b (diff)
downloadrainbows-026219a98c0ecf919c3ecce32ba389254a571795.tar.gz
It's too complicated to deal with multiple Rev loops
so only use the main one for now under 1.9.
-rw-r--r--lib/rainbows/rev/deferred_response.rb6
1 files changed, 5 insertions, 1 deletions
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