diff --git a/src/nsqphp/Connection/Connection.php b/src/nsqphp/Connection/Connection.php index 6a49e6d..31d6682 100644 --- a/src/nsqphp/Connection/Connection.php +++ b/src/nsqphp/Connection/Connection.php @@ -145,7 +145,8 @@ public function read($len) $null = NULL; $read = array($socket = $this->getSocket()); $buffer = $data = ''; - while (strlen($data) < $len) { + $originLen = $len; + while (strlen($data) < $originLen) { $readable = stream_select($read, $null, $null, $this->readWriteTimeoutSec, $this->readWriteTimeoutUsec); if ($readable > 0) { $buffer = @stream_socket_recvfrom($socket, $len); @@ -242,4 +243,4 @@ public function __toString() { return "{$this->hostname}:{$this->port}"; } -} \ No newline at end of file +}