diff options
author | Steve Kemp <steve@steve.org.uk> | 2013-05-15 16:20:41 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2013-05-15 16:20:41 +0100 |
commit | 19fd7ac18460e3e5206496cf5f6bf629aff3e2a9 (patch) | |
tree | ad4425c0e823b501b74b1c38a217e3c1dac011ba /lib/custodian/protocoltest/tcp.rb | |
parent | 4b3f47175b109c6da2fb738d05b037d80b0b87f4 (diff) |
Honour the global timeout period.
The global configuration file, /etc/custodian/custodian.cfg, has a
timeout=XX setting in it. Until now we've ignored it and used a
fixed timeout of 20/30 seconds.
Now we fully honour the specified value.
Diffstat (limited to 'lib/custodian/protocoltest/tcp.rb')
-rw-r--r-- | lib/custodian/protocoltest/tcp.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/custodian/protocoltest/tcp.rb b/lib/custodian/protocoltest/tcp.rb index a28ed33..30083cd 100644 --- a/lib/custodian/protocoltest/tcp.rb +++ b/lib/custodian/protocoltest/tcp.rb @@ -1,4 +1,5 @@ +require 'custodian/settings' require 'custodian/testfactory' require 'socket' require 'timeout' @@ -140,8 +141,15 @@ module Custodian # # def run_test_internal( host, port, banner = nil, do_read = true ) + + # + # Get the timeout period for this test. + # + settings = Custodian::Settings.instance() + period = settings.timeout() + begin - timeout(30) do + timeout(period) do begin socket = TCPSocket.new( host, port ) |