lib/rainbows/event_machine/client.rb in rainbows-4.7.0 vs lib/rainbows/event_machine/client.rb in rainbows-5.0.0

- old
+ new

@@ -21,26 +21,26 @@ @buf << data @_io.shutdown(Socket::SHUT_RD) if @buf.size > 0x1c000 end EM.next_tick { receive_data(nil) } unless @buf.empty? else - on_read(data || Z) if (@buf.size > 0) || data + on_read(data || ''.freeze) if (@buf.size > 0) || data end end def quit super close_connection_after_writing if nil == @deferred end def app_call input set_comm_inactivity_timeout 0 - @env[RACK_INPUT] = input - @env[REMOTE_ADDR] = @_io.kgio_addr - @env[ASYNC_CALLBACK] = method(:write_async_response) - @env[ASYNC_CLOSE] = EM::DefaultDeferrable.new - @hp.hijack_setup(@env, @_io) + @env['rack.input'] = input + @env['REMOTE_ADDR'] = @_io.kgio_addr + @env['async.callback'] = method(:write_async_response) + @env['async.close'] = EM::DefaultDeferrable.new + @hp.hijack_setup(@_io) status, headers, body = catch(:async) { APP.call(@env.merge!(RACK_DEFAULTS)) } return hijacked if @hp.hijacked? @@ -115,10 +115,10 @@ @hp.keepalive? ? receive_data(nil) : quit end def unbind return if @hp.hijacked? - async_close = @env[ASYNC_CLOSE] and async_close.succeed + async_close = @env['async.close'] and async_close.succeed @deferred.respond_to?(:fail) and @deferred.fail begin @_io.close rescue Errno::EBADF # EventMachine's EventableDescriptor::Close() may close