Skip to content

Commit 2ac46aa

Browse files
Added retry when SOCKET_EINTR
1 parent 8ec8874 commit 2ac46aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/connection/Socket.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ public function read(int $length = 2048): string
8080
if (mb_strlen($output, '8bit') == 0 && $this->timeout > 0 && (microtime(true) - $t) >= $this->timeout)
8181
throw new ConnectionTimeoutException('Read from connection reached timeout after ' . $this->timeout . ' seconds.');
8282
$readed = @socket_read($this->socket, $length - mb_strlen($output, '8bit'));
83-
if ($readed === false)
83+
if ($readed === false) {
84+
if (socket_last_error($this->socket) === 10004)
85+
continue;
8486
$this->throwConnectException();
87+
}
8588
$output .= $readed;
8689
} while (mb_strlen($output, '8bit') < $length);
8790

0 commit comments

Comments
 (0)