about summary refs log tree commit homepage
path: root/lib/rainbows/event_machine.rb
diff options
context:
space:
mode:
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?