From 42747db815ad668b20849afb2a9dcdd1319713ae Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 2 Nov 2010 12:32:23 -0700 Subject: avoid Errno::EAGAIN, harder Errno::EAGAIN is still a problem under Ruby 1.9.2, so try harder to avoid it and use kgio methods. Even when 1.9.3 is available, kgio will still be faster as exceptions are slower than normal return values. --- lib/rainbows/fiber/base.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/rainbows/fiber/base.rb') diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index b7c4ce5..69bf5d9 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -56,19 +56,6 @@ module Rainbows::Fiber::Base max.nil? || max > (now + 1) ? 1 : max - now end - def wait_headers_readable(client) - io = client.to_io - expire = nil - begin - return io.recv_nonblock(1, Socket::MSG_PEEK) - rescue Errno::EAGAIN - return if expire && expire < Time.now - expire ||= Time.now + G.kato - client.wait_readable - retry - end - end - def process(client) G.cur += 1 process_client(client) -- cgit v1.2.3-24-ge0c7