Skip to content

Commit

Permalink
Fixed #57: Incorrect EOF test in getMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvargiu committed Dec 27, 2016
1 parent 61e5860 commit 6cbc707
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PAMI/Client/Impl/ClientImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ClientImpl implements IClient

/**
* The receiving queue.
* @var IncomingMessage[]
* @var ResponseMessage[]
*/
private $incomingQueue;

Expand Down Expand Up @@ -238,7 +238,7 @@ protected function getMessages()
$msgs = array();
// Read something.
$read = @fread($this->socket, 65535);
if ($read === false || @feof($this->socket)) {
if ($read === false || (empty($read) && @feof($this->socket))) {
throw new ClientException('Error reading');
}
$this->currentProcessingMessage .= $read;
Expand Down Expand Up @@ -372,12 +372,12 @@ private function messageToEvent($msg)
*
* @todo not suitable for multithreaded applications.
*
* @return \PAMI\Message\IncomingMessage
* @return \PAMI\Message\Response\ResponseMessage
*/
protected function getRelated(OutgoingMessage $message)
{
$ret = false;
$id = $message->getActionID('ActionID');
$id = $message->getActionID();
if (isset($this->incomingQueue[$id])) {
$response = $this->incomingQueue[$id];
if ($response->isComplete()) {
Expand Down

0 comments on commit 6cbc707

Please sign in to comment.