summary refs log tree commit homepage
path: root/lib/rainbows/event_machine.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-19 10:10:00 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-19 17:04:30 -0700
commit593fd91098cbfac13063779226ea65cf5674e3cd (patch)
tree97e642fa72c1ba8c014306319f747730d9ba1258 /lib/rainbows/event_machine.rb
parent7e2758692d70090b193f73212ae9cebc8fdcb7cb (diff)
We also properly fail on EM::FileStreamer responses, too
Diffstat (limited to 'lib/rainbows/event_machine.rb')
-rw-r--r--lib/rainbows/event_machine.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 3da6565..0876ac9 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -106,9 +106,9 @@ module Rainbows
         else
           headers = nil
         end
-        @body = body
 
         if body.respond_to?(:errback) && body.respond_to?(:callback)
+          @body = body
           body.callback { quit }
           body.errback { quit }
           # async response, this could be a trickle as is in comet-style apps
@@ -120,7 +120,7 @@ module Rainbows
 
           if st.file?
             write(response_header(status, headers)) if headers
-            stream = stream_file_data(body.to_path)
+            @body = stream = stream_file_data(body.to_path)
             stream.callback { quit } unless alive
             return
           elsif st.socket? || st.pipe?