=begin
Breaks if the IO doesn't respond to read_nonblock. StringIO, for example. Fall back to sysread in that case:
Index: lib/net/protocol.rb¶
--- lib/net/protocol.rb (revision 22024)
+++ lib/net/protocol.rb (working copy)
@@ -131,14 +131,20 @@
BUFSIZE = 1024 * 16
def rbuf_fill
-
begin
-
@rbuf << @io.read_nonblock(BUFSIZE)
-
rescue Errno::EWOULDBLOCK
-
if IO.select([@io], nil, nil, @read_timeout)
-
retry
-
else
-
raise Timeout::TimeoutError
-
if @io.respond_to?(:read_nonblock)
-
begin
-
@rbuf << @io.read_nonblock(BUFSIZE)
-
rescue Errno::EWOULDBLOCK
-
if IO.select([@io], nil, nil, @read_timeout)
-
retry
-
else
-
raise Timeout::TimeoutError
-
end
end
-
else
-
timeout(@read_timeout) do
-
@rbuf << @io.sysread(BUFSIZE)
-
end
end
end
=end