summary refs log tree commit homepage
path: root/lib/rainbows/event_machine.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
committerEric Wong <normalperson@yhbt.net>2010-09-28 17:40:01 -0700
commitad821f70a2488a91f2be1ac53cb2e64f50743989 (patch)
tree6db4d334106360305ba3b66b643e8694f232fa10 /lib/rainbows/event_machine.rb
parent11c75ec06ce72cea0c760161dc01a196500aa293 (diff)
It removes the burden of byte slicing and setting file
descriptor flags.  In some cases, we can remove unnecessary
peeraddr calls, too.
Diffstat (limited to 'lib/rainbows/event_machine.rb')
-rw-r--r--lib/rainbows/event_machine.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index 5586d3e..96d9a9e 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -84,7 +84,7 @@ module Rainbows
       def app_call
         set_comm_inactivity_timeout 0
         @env[RACK_INPUT] = @input
-        @env[REMOTE_ADDR] = @remote_addr
+        @env[REMOTE_ADDR] = @_io.kgio_addr
         @env[ASYNC_CALLBACK] = method(:em_write_response)
         @env[ASYNC_CLOSE] = EM::DefaultDeferrable.new
 
@@ -170,8 +170,6 @@ module Rainbows
     end
 
     module Server # :nodoc: all
-      include Rainbows::Acceptor
-
       def close
         detach
         @io.close
@@ -179,7 +177,7 @@ module Rainbows
 
       def notify_readable
         return if CUR.size >= MAX
-        io = accept(@io) or return
+        io = @io.kgio_tryaccept or return
         sig = EM.attach_fd(io.fileno, false)
         CUR[sig] = CL.new(sig, io)
       end