From 905f0ff393629ddb4d70e3dc221b016128c47415 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 28 Jun 2011 07:39:35 +0000 Subject: require kgio 2.5 for kgio_wait_readable(timeout) 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. --- lib/rainbows/client.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/rainbows/client.rb') 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 -- cgit v1.2.3-24-ge0c7