diff options
Diffstat (limited to 'lib/net/protocol.rb')
-rw-r--r-- | lib/net/protocol.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 0a54536407..9733d56c93 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -44,8 +44,19 @@ module Net # :nodoc: class ProtoCommandError < ProtocolError; end class ProtoRetriableError < ProtocolError; end ProtocRetryError = ProtoRetriableError + + ## + # OpenTimeout, a subclass of Timeout::Error, is raised if a connection cannot + # be created within the open_timeout. + class OpenTimeout < Timeout::Error; end + ## + # ReadTimeout, a subclass of Timeout::Error, is raised if a chunk of the + # response cannot be read within the read_timeout. + + class ReadTimeout < Timeout::Error; end + class BufferedIO #:nodoc: internal use only def initialize(io) @@ -144,7 +155,7 @@ module Net # :nodoc: if IO.select([@io], nil, nil, @read_timeout) retry else - raise Timeout::Error + raise Net::ReadTimeout end rescue IO::WaitWritable # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable. @@ -152,7 +163,7 @@ module Net # :nodoc: if IO.select(nil, [@io], nil, @read_timeout) retry else - raise Timeout::Error + raise Net::ReadTimeout end end end |