Workaround an IO::Socket::IP bug
authorMatt Caswell <matt@openssl.org>
Mon, 16 May 2016 15:54:28 +0000 (16:54 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 16 May 2016 16:19:55 +0000 (17:19 +0100)
Workaround an apparent IO:Socket::IP bug where a seemingly valid
server socket is being returned even though a valid connection does not
exist. This causes the tests to intermittently hang. We additionally check
that the peerport looks ok to verify that the returned socket looks usable.

Reviewed-by: Richard Levitte <levitte@openssl.org>
util/TLSProxy/Proxy.pm

index 950fd9074923492936584ce48b32018e8a27d11e..3b03ea9eeb2d2118b4e0de0488d86f2043e13a7d 100644 (file)
@@ -236,7 +236,9 @@ sub clientstart
         };
 
         $retry--;
-        if ($@ || !defined($server_sock)) {
+        #Some buggy IP factories can return a defined server_sock that hasn't
+        #actually connected, so we check peerport too
+        if ($@ || !defined($server_sock) || !defined($server_sock->peerport)) {
             $server_sock->close() if defined($server_sock);
             undef $server_sock;
             if ($retry) {