From 45f772cfe7626ec7c250d89c7291c23decf13558 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 8 Aug 2017 16:38:10 +0300 Subject: Moved case statement outside timeout block. Also removed a redudant `begin`. --- lib/custodian/protocoltest/http.rb | 31 +++++++++++++++---------------- 1 file 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: # -- cgit v1.2.1