Skip to content

Commit

Permalink
fix: 修复无法第二次执行 stream_socket_recvfrom 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dzvon committed Dec 11, 2019
1 parent d3d1fb9 commit 1fc78fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Connection/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ public function read($len)
$null = NULL;
$read = array($socket = $this->getSocket());
$buffer = $data = '';
while (strlen($data) < $len) {
$totalBytes = $len;
while (strlen($data) < $totalBytes) {
$readable = stream_select($read, $null, $null, $this->readWriteTimeoutSec, $this->readWriteTimeoutUsec);
if ($readable > 0) {
$buffer = @stream_socket_recvfrom($socket, $len);
Expand Down

0 comments on commit 1fc78fa

Please sign in to comment.