Project

General

Profile

Feature #4560 ยป 0001-lib-net-protocol.rb-avoid-exceptions-in-rbuf_fill.patch

normalperson (Eric Wong), 04/07/2011 11:48 AM

View differences:

lib/net/protocol.rb
require 'socket'
require 'timeout'
require 'io/wait'
module Net # :nodoc:
......
BUFSIZE = 1024 * 16
def rbuf_fill
if @io.respond_to?(:wait)
false == @io.wait(@read_timeout) and raise Timeout::Error
end
begin
@rbuf << @io.read_nonblock(BUFSIZE)
rescue IO::WaitReadable
    (1-1/1)