about summary refs log tree commit homepage
path: root/lib/rainbows/revactor.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-27 18:21:08 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-27 18:21:08 -0800
commite537f067c589c4e0b206878a42169c743d3e3ff2 (patch)
tree0c7814cceec4e52e09e56fcab4d1ca6290ab4ab4 /lib/rainbows/revactor.rb
parent2661b5dc2f95dc6a081980a59d999881d804c90d (diff)
downloadrainbows-e537f067c589c4e0b206878a42169c743d3e3ff2.tar.gz
instance_variable_{set,get} are faster, but equally ugly
Diffstat (limited to 'lib/rainbows/revactor.rb')
-rw-r--r--lib/rainbows/revactor.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index 6ecf11b..5c813ff 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -30,8 +30,9 @@ module Rainbows
     # once a client is accepted, it is processed in its entirety here
     # in 3 easy steps: read request, call app, write app response
     def process_client(client)
+      io = client.instance_variable_get(:@_io)
       defined?(Fcntl::FD_CLOEXEC) and
-        client.instance_eval { @_io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) }
+        io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
       rd_args = [ nil ]
       remote_addr = if ::Revactor::TCP::Socket === client
         rd_args << RD_ARGS
@@ -68,7 +69,7 @@ module Rainbows
       end while alive and hp.reset.nil? and env.clear
     rescue ::Revactor::TCP::ReadError
     rescue => e
-      Error.write(client.instance_eval { @_io }, e)
+      Error.write(io, e)
     ensure
       client.close
     end
@@ -86,7 +87,7 @@ module Rainbows
       revactorize_listeners.each do |l, close, accept|
         Actor.spawn(l, close, accept) do |l, close, accept|
           Actor.current.trap_exit = true
-          l.controller = l.instance_eval { @receiver = Actor.current }
+          l.controller = l.instance_variable_set(:@receiver, Actor.current)
           begin
             while nr >= limit
               l.disable if l.enabled?