about summary refs log tree commit homepage
path: root/lib/rainbows/client.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-28 07:39:35 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-28 07:39:35 +0000
commit905f0ff393629ddb4d70e3dc221b016128c47415 (patch)
treedd6689cac2e79d1b76b726a5c74c268d398d46cd /lib/rainbows/client.rb
parent9684ed46e78dab1ae787fe135a3cec1c4490ddd6 (diff)
downloadrainbows-905f0ff393629ddb4d70e3dc221b016128c47415.tar.gz
Since kgio_wait_*able in kgio 2.5 takes an optional timeout
argument, we no longer have to load the extra "io/wait" module.
This saves us a small amount of some memory and also removes the
extra ioctl(FIONREAD) syscall IO#wait enforces.

Like IO#wait in Ruby 1.9.3dev, kgio_wait_readable may use
ppoll() to wait on high-numbered file descriptors as efficiently
as it waits on low-numbered descriptors.
Diffstat (limited to 'lib/rainbows/client.rb')
-rw-r--r--lib/rainbows/client.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/rainbows/client.rb b/lib/rainbows/client.rb
index cc02c0b..d8a30b2 100644
--- a/lib/rainbows/client.rb
+++ b/lib/rainbows/client.rb
@@ -1,6 +1,5 @@
 # -*- encoding: binary -*-
 # :enddoc:
-require "io/wait"
 
 # this class is used for most synchronous concurrency models
 class Rainbows::Client < Kgio::Socket
@@ -11,10 +10,6 @@ class Rainbows::Client < Kgio::Socket
     Time.now + KEEPALIVE_TIMEOUT
   end
 
-  def kgio_wait_readable
-    wait KEEPALIVE_TIMEOUT
-  end
-
   # used for reading headers (respecting keepalive_timeout)
   def timed_read(buf)
     expire = nil
@@ -23,7 +18,7 @@ class Rainbows::Client < Kgio::Socket
       when :wait_readable
         return if expire && expire < Time.now
         expire ||= read_expire
-        kgio_wait_readable
+        kgio_wait_readable(KEEPALIVE_TIMEOUT)
       else
         return rv
       end