diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-16 03:37:23 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-16 03:37:23 +0000 |
| commit | aefad35e2c5ef6077a095b66e2d59602d36f83ef (patch) | |
| tree | fc3d9a3b547bcab1a95ff2fa64c58b0c4c7cd5f0 /lib/resolv.rb | |
| parent | 4e787e1242e1a63b55c030e9e0164e00130fd1c6 (diff) | |
| download | ruby-aefad35e2c5ef6077a095b66e2d59602d36f83ef.tar.gz ruby-aefad35e2c5ef6077a095b66e2d59602d36f83ef.tar.xz ruby-aefad35e2c5ef6077a095b66e2d59602d36f83ef.zip | |
* lib/timeout.rb (timeout): new optional argument to specify an
exception class.
* lib/resolv.rb: use Resolv::ResolvTimeout for internal timeout to
avoid problem with timeout of application.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/resolv.rb')
| -rw-r--r-- | lib/resolv.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb index 4c9582665..bfe8dd8b6 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -258,6 +258,9 @@ class Resolv class ResolvError < StandardError end + class ResolvTimeout < TimeoutError + end + class Hosts DefaultFileName = '/etc/hosts' @@ -426,7 +429,7 @@ class Resolv end sender.send reply = reply_name = nil - timeout(tout) { reply, reply_name = q.pop } + timeout(tout, ResolvTimeout) { reply, reply_name = q.pop } case reply.rcode when RCode::NoError extract_resources(reply, reply_name, typeclass, &proc) @@ -753,7 +756,7 @@ class Resolv @nameserver.each {|nameserver| begin yield candidate, tout, nameserver - rescue TimeoutError + rescue ResolvTimeout end } } |
