Skip to content

Commit 5987bb3

Browse files
Merge pull request #179 from stefanak-michal/stefanak-michal-patch-1
Int value for error can vary based on platform
2 parents a6384c0 + e44418a commit 5987bb3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/connection/Socket.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Socket extends AConnection
2121
private $socket = false;
2222

2323
private const POSSIBLE_TIMEOUTS_CODES = [11, 10060];
24+
private const POSSIBLE_RETRY_CODES = [4, 10004];
2425

2526
public function connect(): bool
2627
{
@@ -81,7 +82,7 @@ public function read(int $length = 2048): string
8182
throw new ConnectionTimeoutException('Read from connection reached timeout after ' . $this->timeout . ' seconds.');
8283
$readed = @socket_read($this->socket, $length - mb_strlen($output, '8bit'));
8384
if ($readed === false) {
84-
if (socket_last_error($this->socket) === 10004)
85+
if (in_array(socket_last_error($this->socket), self::POSSIBLE_RETRY_CODES, true))
8586
continue;
8687
$this->throwConnectException();
8788
}

0 commit comments

Comments
 (0)