about summary refs log tree commit homepage
path: root/lib/rainbows
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-21 17:34:21 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-21 17:34:21 -0800
commit01fbc4a7f2fd5b751b9183d11aa74aadaffd145b (patch)
treef672c1ae40267c88e5bce7662b6e361c93548c01 /lib/rainbows
parent9719da13b8aabeabbf2eebc37f127e88550c3121 (diff)
downloadrainbows-01fbc4a7f2fd5b751b9183d11aa74aadaffd145b.tar.gz
No need to setting an ivar for most requests
Diffstat (limited to 'lib/rainbows')
-rw-r--r--lib/rainbows/coolio/client.rb4
-rw-r--r--lib/rainbows/coolio/thread_client.rb4
-rw-r--r--lib/rainbows/epoll/client.rb4
-rw-r--r--lib/rainbows/ev_core.rb7
-rw-r--r--lib/rainbows/event_machine/client.rb4
-rw-r--r--lib/rainbows/never_block/event_machine.rb2
6 files changed, 12 insertions, 13 deletions
diff --git a/lib/rainbows/coolio/client.rb b/lib/rainbows/coolio/client.rb
index 0ccccff..f1f16d3 100644
--- a/lib/rainbows/coolio/client.rb
+++ b/lib/rainbows/coolio/client.rb
@@ -106,10 +106,10 @@ class Rainbows::Coolio::Client < Coolio::IO
     @state = :headers
   end
 
-  def app_call
+  def app_call input
     KATO.delete(self)
     disable if enabled?
-    @env[RACK_INPUT] = @input
+    @env[RACK_INPUT] = input
     @env[REMOTE_ADDR] = @_io.kgio_addr
     @env[ASYNC_CALLBACK] = method(:write_async_response)
     status, headers, body = catch(:async) {
diff --git a/lib/rainbows/coolio/thread_client.rb b/lib/rainbows/coolio/thread_client.rb
index b837115..abc11d2 100644
--- a/lib/rainbows/coolio/thread_client.rb
+++ b/lib/rainbows/coolio/thread_client.rb
@@ -5,10 +5,10 @@ RUBY_VERSION =~ %r{\A1\.8} and
   warn "Coolio and Threads do not mix well under Ruby 1.8"
 
 class Rainbows::Coolio::ThreadClient < Rainbows::Coolio::Client
-  def app_call
+  def app_call input
     KATO.delete(self)
     disable if enabled?
-    @env[RACK_INPUT] = @input
+    @env[RACK_INPUT] = input
     app_dispatch # must be implemented by subclass
   end
 
diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb
index 490f38b..6bf12f1 100644
--- a/lib/rainbows/epoll/client.rb
+++ b/lib/rainbows/epoll/client.rb
@@ -49,8 +49,8 @@ module Rainbows::Epoll::Client
     rescue IOError
   end
 
-  def app_call # called by on_read()
-    @env[RACK_INPUT] = @input
+  def app_call input # called by on_read()
+    @env[RACK_INPUT] = input
     @env[REMOTE_ADDR] = kgio_addr
     status, headers, body = APP.call(@env.merge!(RACK_DEFAULTS))
     ev_write_response(status, headers, body, @hp.next?)
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb
index 826dce6..61853ab 100644
--- a/lib/rainbows/ev_core.rb
+++ b/lib/rainbows/ev_core.rb
@@ -83,8 +83,7 @@ module Rainbows::EvCore
       @hp.parse or return want_more
       @state = :body
       if 0 == @hp.content_length
-        @input = NULL_IO
-        app_call # common case
+        app_call NULL_IO # common case
       else # nil or len > 0
         prepare_request_body
       end
@@ -92,7 +91,7 @@ module Rainbows::EvCore
       if @hp.body_eof?
         if @hp.content_length
           @input.rewind
-          app_call
+          app_call @input
         else
           @state = :trailers
           on_read(data)
@@ -107,7 +106,7 @@ module Rainbows::EvCore
     when :trailers
       if @hp.trailers(@env, @buf << data)
         @input.rewind
-        app_call
+        app_call @input
       else
         want_more
       end
diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb
index 1b15daa..8c2549d 100644
--- a/lib/rainbows/event_machine/client.rb
+++ b/lib/rainbows/event_machine/client.rb
@@ -30,9 +30,9 @@ class Rainbows::EventMachine::Client < EM::Connection
     close_connection_after_writing
   end
 
-  def app_call
+  def app_call input
     set_comm_inactivity_timeout 0
-    @env[RACK_INPUT] = @input
+    @env[RACK_INPUT] = input
     @env[REMOTE_ADDR] = @_io.kgio_addr
     @env[ASYNC_CALLBACK] = method(:write_async_response)
     @env[ASYNC_CLOSE] = EM::DefaultDeferrable.new
diff --git a/lib/rainbows/never_block/event_machine.rb b/lib/rainbows/never_block/event_machine.rb
index e201492..be72ab6 100644
--- a/lib/rainbows/never_block/event_machine.rb
+++ b/lib/rainbows/never_block/event_machine.rb
@@ -1,7 +1,7 @@
 # -*- encoding: binary -*-
 # :enddoc:
 class Rainbows::NeverBlock::Client < Rainbows::EventMachine::Client
-  def app_call
+  def app_call input
     POOL.spawn do
       begin
         super