diff --git a/Connection.php b/Connection.php index 2806bab4..63d2e583 100644 --- a/Connection.php +++ b/Connection.php @@ -11,9 +11,10 @@ public function handleData($stream) // Socket is raw, not using fread as it's interceptable by filters // See issues #192, #209, and #240 $data = stream_socket_recvfrom($stream, $this->bufferSize); - if( '' !== $data || false !== $data ){ + if ('' !== $data && false !== $data) { $this->emit('data', array($data, $this)); } + if ('' === $data || false === $data || feof($stream)) { $this->end(); }