From ea9b6997cc8bcb70ea82cb0535d1a4b5a5fd5508 Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 11 Apr 2012 21:20:51 +0000 Subject: * lib/net/protocol.rb (module Net): Added ReadTimeout to match OpenTimeout. ReadTimeout is now raised by rbuf_fill instead of Timeout::Error to help users distinguish what type of timeout occurred. [ruby-trunk - Feature #6088] * lib/net/pop.rb (module Net): Updated documentation for ReadTimeout and OpenTimeout. * lib/net/http.rb (module Net): ditto * lib/net/smtp.rb (module Net): ditto * lib/net/telnet.rb (module Net): Net::ReadTimeout is now raised in waitfor to match Net::Protocol. * test/net/http/test_http.rb: Updated Timeout::Error expectation to Net::ReadTimeout. * test/net/ftp/test_ftp.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/telnet.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/net/telnet.rb') diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb index 25fbac2728..3c5d6e8e73 100644 --- a/lib/net/telnet.rb +++ b/lib/net/telnet.rb @@ -243,15 +243,15 @@ module Net # # Timeout:: the number of seconds to wait before timing out both the # initial attempt to connect to host (in this constructor), - # and all attempts to read data from the host (in #waitfor(), - # #cmd(), and #login()). Exceeding this timeout causes a - # TimeoutError to be raised. The default value is 10 seconds. + # which raises a Net::OpenTimeout, and all attempts to read data + # from the host, which raises a Net::ReadTimeout (in #waitfor(), + # #cmd(), and #login()). The default value is 10 seconds. # You can disable the timeout by setting this value to false. # In this case, the connect attempt will eventually timeout # on the underlying connect(2) socket call with an # Errno::ETIMEDOUT error (but generally only after a few # minutes), but other attempts to read data from the host - # will hand indefinitely if no data is forthcoming. + # will hang indefinitely if no data is forthcoming. # # Waittime:: the amount of time to wait after seeing what looks like a # prompt (that is, received data that matches the Prompt @@ -554,7 +554,7 @@ module Net rest = '' until(prompt === line and not IO::select([@sock], nil, nil, waittime)) unless IO::select([@sock], nil, nil, time_out) - raise TimeoutError, "timed out while waiting for more data" + raise Net::ReadTimeout, "timed out while waiting for more data" end begin c = @sock.readpartial(1024 * 1024) -- cgit v1.2.3