10000 Fix optional test for `ENETUNREACH` error condition · reactphp/socket@c015786 · GitHub
[go: up one dir, main page]

Skip to content

Commit c015786

Browse files
committed
Fix optional test for ENETUNREACH error condition
1 parent f9bc429 commit c015786

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

tests/TcpConnectorTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function connectionToInvalidNetworkShouldFailWithUnreachableError()
132132
$errstr = '';
133133
for ($i = 0; $i < 20 && $errno !== $enetunreach; ++$i) {
134134
$address = 'tcp://192.168.' . mt_rand(0, 255) . '.' . mt_rand(1, 254) . ':8123';
135-
$client = @stream_socket_client($address, $errno, $errstr, 0.1 * $i);
135+
$client = @stream_socket_client($address, $errno, $errstr, 0.1);
136136
}
137137
if ($client || $errno !== $enetunreach) {
138138
$this->markTestSkipped('Expected error ' . $enetunreach . ' but got ' . $errno . ' (' . $errstr . ') for ' . $address);
@@ -147,14 +147,7 @@ public function connectionToInvalidNetworkShouldFailWithUnreachableError()
147147
'Connection to ' . $address . ' failed: ' . (function_exists('socket_strerror') ? socket_strerror($enetunreach) . ' (ENETUNREACH)' : 'Network is unreachable'),
148148
$enetunreach
149149
);
150-
151-
try {
152-
Block\await($promise, null, self::TIMEOUT);
153-
} catch (\Exception $e) {
154-
fclose($client);
155-
156-
throw $e;
157-
}
150+
Block\await($promise, null, self::TIMEOUT);
158151
}
159152

160153
/** @test */

0 commit comments

Comments
 (0)
0