summaryrefslogtreecommitdiff
path: root/lib/net/protocol.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/protocol.rb')
-rw-r--r--lib/net/protocol.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index e2423f2986..d927c52f34 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -133,12 +133,20 @@ module Net # :nodoc:
def rbuf_fill
begin
@rbuf << @io.read_nonblock(BUFSIZE)
- rescue Errno::EWOULDBLOCK
+ rescue IO::WaitReadable
if IO.select([@io], nil, nil, @read_timeout)
retry
else
raise Timeout::TimeoutError
end
+ rescue IO::WaitWritable
+ # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
+ # http://www.openssl.org/support/faq.html#PROG10
+ if IO.select(nil, [@io], nil, @read_timeout)
+ retry
+ else
+ raise Timeout::TimeoutError
+ end
end
end