diff options
author | Steve Kemp <steve@steve.org.uk> | 2017-08-08 16:38:10 +0300 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2017-08-08 16:38:10 +0300 |
commit | 45f772cfe7626ec7c250d89c7291c23decf13558 (patch) | |
tree | 184257d7e27908133361504c4b68aa40834f7258 /lib | |
parent | 3be19cc5ba17e084c10c8f5d0eb114b01e53f733 (diff) |
Moved case statement outside timeout block.13-catch-bogus-dns
Also removed a redudant `begin`.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/custodian/protocoltest/http.rb | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index 9ff734c..0bf1a68 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -89,27 +89,26 @@ module Custodian # look it up, as both IPv4 and IPv6. # begin - timeout(30) do - type = case protocol - when :ipv4 - Resolv::DNS::Resource::IN::A - when :ipv6 - Resolv::DNS::Resource::IN::AAAA - else - raise ArgumentError, "Sanity-checking DNS-failure of unknown type: #{protocol}" - end - - begin - Resolv::DNS.open do |dns| - ips = dns.getresources(target, type) - end - rescue Timeout::Error => _e - # NOP + type = case protocol + when :ipv4 + Resolv::DNS::Resource::IN::A + when :ipv6 + Resolv::DNS::Resource::IN::AAAA + else + raise ArgumentError, "Sanity-checking DNS-failure of unknown type: #{protocol}" + end + + timeout(30) do + Resolv::DNS.open do |dns| + ips = dns.getresources(target, type) end end + rescue Timeout::Error => _e + # NOP end + # # At this point we either have: # |