TLSProxy/Proxy.pm: handle "impossible" failure to connect to s_server.
authorAndy Polyakov <appro@openssl.org>
Wed, 11 Apr 2018 12:56:37 +0000 (14:56 +0200)
committerAndy Polyakov <appro@openssl.org>
Fri, 13 Apr 2018 08:14:27 +0000 (10:14 +0200)
The failure is "impossible", because we have confirmation that s_server
listens, yet Mac OS X fails to connect. This avoids 10 minutes timeout
on Travis CI.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5907)

util/perl/TLSProxy/Proxy.pm

index 19b09a4744d5deaefb12bdcf8f68baa5867b105a..45d88bffaa97c91bc91ead6c2492a251571ec7e3 100644 (file)
@@ -189,10 +189,16 @@ sub connect_to_server
 
     $servaddr =~ s/[\[\]]//g; # Remove [ and ]
 
-    $self->{server_sock} = $IP_factory->(PeerAddr => $servaddr,
-                                         PeerPort => $self->{server_port},
-                                         Proto => 'tcp')
-                           or die "unable to connect: $!\n";
+    my $sock = $IP_factory->(PeerAddr => $servaddr,
+                             PeerPort => $self->{server_port},
+                             Proto => 'tcp');
+    if (!defined($sock)) {
+        my $err = $!;
+        kill(3, $self->{real_serverpid});
+        die "unable to connect: $err\n";
+    }
+
+    $self->{server_sock} = $sock;
 }
 
 sub start