[Tools 2/3] testbot/TestAgent: Add --connect-attempts and --connect-interval options.

Francois Gouget <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <E1e6zZ5-00006N-QI@amboise>
Signed-off-by: Francois Gouget <[email protected]>
---
 testbot/scripts/TestAgent | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/testbot/scripts/TestAgent b/testbot/scripts/TestAgent
index 33fc298f..bfc4fbc7 100755
--- a/testbot/scripts/TestAgent
+++ b/testbot/scripts/TestAgent
@@ -56,7 +56,8 @@ my ($Cmd, $Hostname, $LocalFilename, $ServerFilename, $PropName, @Rm);
 my (@Run, $RunIn, $RunOut, $RunErr, $WaitPid);
 my $SendFlags = 0;
 my $RunFlags = 0;
-my ($Port, $ConnectTimeout, $Timeout, $Keepalive, $TunnelOpt);
+my ($Port, $ConnectTimeout, $ConnectAttempts, $ConnectInterval, $Timeout);
+my ($Keepalive, $TunnelOpt);
 my $Usage;
 
 sub set_cmd($)
@@ -103,6 +104,14 @@ while (@ARGV)
     {
         $ConnectTimeout = check_opt_val($arg, $ConnectTimeout);
     }
+    elsif ($arg eq "--connect-attempts")
+    {
+        $ConnectAttempts = check_opt_val($arg, $ConnectAttempts);
+    }
+    elsif ($arg eq "--connect-interval")
+    {
+        $ConnectInterval = check_opt_val($arg, $ConnectInterval);
+    }
     elsif ($arg eq "--timeout")
     {
         $Timeout = check_opt_val($arg, $Timeout);
@@ -340,6 +349,9 @@ if (defined $Usage)
     print "  --port <port> Use the specified port number instead of the default one.\n";
     print "  --connect-timeout <timeout> Use the specified timeout (in seconds) when\n";
     print "                connecting instead of the default one.\n";
+    print "  --connect-attempts <count> How many connection attempts to perform.\n";
+    print "  --connect-interval <time> The minimum interval (in seconds) between failed\n";
+    print "                connection attempts.\n";
     print "  --timeout <timeout> Use the specified timeout (in seconds) instead of the\n";
     print "                default one for the operation.\n";
     print "  --keepalive <keepalive> How often (in seconds) the run and wait operations\n";
@@ -363,7 +375,10 @@ if ($TunnelOpt and $TunnelOpt =~ /^ssh:/)
 }
 
 my $TA = TestAgent->new($Hostname, $AgentPort, $TunnelInfo);
-$TA->SetConnectTimeout($ConnectTimeout) if (defined $ConnectTimeout);
+if (defined $ConnectTimeout or defined $ConnectAttempts or defined $ConnectInterval)
+{
+    $TA->SetConnectTimeout($ConnectTimeout, $ConnectAttempts, $ConnectInterval);
+}
 $TA->SetTimeout($Timeout) if (defined $Timeout);
 
 my $RC = 0;
-- 
2.14.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.