summaryrefslogtreecommitdiff
path: root/lib/net/telnet.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-28 05:15:54 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-28 05:15:54 +0000
commit09f27873ed653bd4afb5538b669e2362f3b1bf6e (patch)
tree1dab78cb5c936ea9c4ee349e7415617e96371c8a /lib/net/telnet.rb
parent8a7da58c0fe28af09ce0631d6ada79e47cc7b98f (diff)
* lib/net/protocol.rb: Add OpenTimeout subclass of Timeout::Error
* lib/net/pop.rb: Modernize Timeout usage. Patch by Eric Wong. Use Net::OpenTimeout instead of Timeout::Error. [Bug #5765] * lib/net/http.rb: ditto * lib/net/smtp.rb: ditto * lib/net/telnet.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/telnet.rb')
-rw-r--r--lib/net/telnet.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb
index fe463c63dc..25fbac2728 100644
--- a/lib/net/telnet.rb
+++ b/lib/net/telnet.rb
@@ -9,8 +9,7 @@
# For documentation, see Net::Telnet.
#
-require "socket"
-require "timeout"
+require "net/protocol"
require "English"
module Net
@@ -347,12 +346,12 @@ module Net
if @options["Timeout"] == false
@sock = TCPSocket.open(@options["Host"], @options["Port"])
else
- timeout(@options["Timeout"]) do
+ Timeout.timeout(@options["Timeout"], Net::OpenTimeout) do
@sock = TCPSocket.open(@options["Host"], @options["Port"])
end
end
- rescue TimeoutError
- raise TimeoutError, "timed out while opening a connection to the host"
+ rescue Net::OpenTimeout
+ raise Net::OpenTimeout, "timed out while opening a connection to the host"
rescue
@log.write($ERROR_INFO.to_s + "\n") if @options.has_key?("Output_log")
@dumplog.log_dump('#', $ERROR_INFO.to_s + "\n") if @options.has_key?("Dump_log")
@@ -508,7 +507,7 @@ module Net
# into a regular expression. Used only if Match and
# Prompt are not specified.
# Timeout:: the number of seconds to wait for data from the host
- # before raising a TimeoutError. If set to false,
+ # before raising a Timeout::Error. If set to false,
# no timeout will occur. If not specified, the
# Timeout option value specified when this instance
# was created will be used, or, failing that, the