From ed28feabd79697cb27722036622aeca1fbf0723d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 30 Dec 2010 08:32:27 +0000 Subject: event_machine: cleanup response_pipe No need to pass unnecessary variables to response_pipe, just let the client handle it all. --- lib/rainbows/event_machine/client.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/rainbows/event_machine/client.rb') diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb index 0b46b42..6863be0 100644 --- a/lib/rainbows/event_machine/client.rb +++ b/lib/rainbows/event_machine/client.rb @@ -91,11 +91,11 @@ class Rainbows::EventMachine::Client < EM::Connection end return elsif st.socket? || st.pipe? - @body = io = body_to_io(body) + io = body_to_io(@body = body) chunk = stream_response_headers(status, headers) if headers m = chunk ? Rainbows::EventMachine::ResponseChunkPipe : Rainbows::EventMachine::ResponsePipe - return EM.watch(io, m, self, alive, body).notify_readable = true + return EM.watch(io, m, self).notify_readable = true end # char or block device... WTF? fall through to body.each end @@ -106,6 +106,7 @@ class Rainbows::EventMachine::Client < EM::Connection end def next! + @body.close if @body.respond_to?(:close) @hp.keepalive? ? receive_data(@body = nil) : quit end -- cgit v1.2.3-24-ge0c7