[PATCH] testbot/TestAgent: Give up early connecting to invalid hostnames / ports.

Francois Gouget fgouget at codeweavers.com
Tue Sep 10 04:01:27 CDT 2019


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/TestAgent.pm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm
index ca81283d..a4a2f490 100644
--- a/testbot/lib/WineTestBot/TestAgent.pm
+++ b/testbot/lib/WineTestBot/TestAgent.pm
@@ -905,6 +905,11 @@ sub _Connect($)
         if (!$self->{fd})
         {
           alarm(0);
+          if ($!{EINVAL})
+          {
+            $self->_SetError($FATAL, "The '$self->{agenthost}' hostname or the '$self->{agentport}' port is invalid.");
+            die "socket";
+          }
           $self->_SetError($FATAL, $!);
           return; # out of eval
         }
@@ -930,12 +935,16 @@ sub _Connect($)
       $self->{rpc} = $OldRPC;
       return 1;
     }
+
     if ($@)
     {
-      $self->_SetError($FATAL, "Timed out in $Step while connecting to $self->{connection}");
+      if ($@ eq "timeout")
+      {
+        $self->_SetError($FATAL, "Timed out in $Step while connecting to $self->{connection}");
+      }
+      last;
     }
-    # Ideally we should probably check the error and not retry if it is likely
-    # permanent, like a hostname that does not resolve.
+
     my $Remaining = $Attempt * $self->{cinterval} - (time() - $Start);
     sleep($Remaining) if ($Remaining > 0);
   }
-- 
2.20.1



More information about the wine-devel mailing list