diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-03-09 13:19:47 +0000 |
commit | 54b21cf54c51dfe40784a8096f84c7a80b015bd4 (patch) | |
tree | 4763692624732650daf1a9e02c91576d3f7ee8d0 /lib/custodian/protocoltest/tcp.rb | |
parent | a22b8e96ead33b0f97ed5243dbad7f7b6cd5135d (diff) |
Removed spaces inside parenthesis.
Diffstat (limited to 'lib/custodian/protocoltest/tcp.rb')
-rw-r--r-- | lib/custodian/protocoltest/tcp.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb index ca622bb..0f7e2b5 100644 --- a/lib/custodian/protocoltest/tcp.rb +++ b/lib/custodian/protocoltest/tcp.rb @@ -60,7 +60,7 @@ module Custodian # # Ensure we received a port to run the TCP-test against. # - def initialize( line ) + def initialize(line) # # Save the line @@ -70,7 +70,7 @@ module Custodian # # Save the host # - @host = line.split( /\s+/)[0] + @host = line.split(/\s+/)[0] # # Is this test inverted? @@ -126,7 +126,7 @@ module Custodian # reset the error, in case we were previously executed. @error = nil - ( run_test_internal( @host, @port, @banner, ( ! @banner.nil? ) ) ) + (run_test_internal(@host, @port, @banner, (! @banner.nil?))) end @@ -148,7 +148,7 @@ module Custodian # # A failure in either version will result in a failure. # - def run_test_internal( host, port, banner = nil, do_read = false ) + def run_test_internal(host, port, banner = nil, do_read = false) # # Get the timeout period. @@ -165,9 +165,9 @@ module Custodian # Does the name look like an IP? # begin - x = IPAddr.new( host ) + x = IPAddr.new(host) if x.ipv4? or x.ipv6? - ips.push( host ) + ips.push(host) end rescue ArgumentError # @@ -197,17 +197,17 @@ module Custodian # look it up, as both IPv4 and IPv6. # begin - timeout( period ) do + timeout(period) do Resolv::DNS.open do |dns| if do_ipv4 ress = dns.getresources(host, Resolv::DNS::Resource::IN::A) - ress.map { |r| ips.push( r.address.to_s ) } + ress.map { |r| ips.push(r.address.to_s) } end if do_ipv6 ress = dns.getresources(host, Resolv::DNS::Resource::IN::AAAA) - ress.map { |r| ips.push( r.address.to_s ) } + ress.map { |r| ips.push(r.address.to_s) } end end end @@ -232,7 +232,7 @@ module Custodian # were given. # ips.each do |ip| - if ! run_test_internal_real( ip, port, banner, do_read ) + if ! run_test_internal_real(ip, port, banner, do_read) return false # @@ -260,7 +260,7 @@ module Custodian # This method will ONLY ever be invoked with an IP-address for a # destination. # - def run_test_internal_real( host, port, banner = nil, do_read = false ) + def run_test_internal_real(host, port, banner = nil, do_read = false) # # Get the timeout period for this test. @@ -271,7 +271,7 @@ module Custodian begin timeout(period) do begin - socket = TCPSocket.new( host, port ) + socket = TCPSocket.new(host, port) # read a banner from the remote server, if we're supposed to. read = nil @@ -293,14 +293,14 @@ module Custodian # regexp. if banner.kind_of? Regexp - if ( !read.nil? ) && ( banner.match(read) ) + if (!read.nil?) && (banner.match(read)) return true end end # string. if banner.kind_of? String - if ( !read.nil? ) && ( read =~ /#{banner}/i ) + if (!read.nil?) && (read =~ /#{banner}/i) return true end end |