Module: tools Branch: master Commit: 68cdb4bfb942b0c98a3e65a8ddbf7e22f8a6ce18 URL: https://source.winehq.org/git/tools.git/?a=commit;h=68cdb4bfb942b0c98a3e65a8...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Sep 10 11:01:27 2019 +0200
testbot/TestAgent: Give up early connecting to invalid hostnames / ports.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 ca81283..a4a2f49 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); }