diff --git a/src/SecureStream.php b/src/SecureStream.php index ce6e1da..b3ba2b1 100644 --- a/src/SecureStream.php +++ b/src/SecureStream.php @@ -43,11 +43,12 @@ public function __construct(Stream $stream, LoopInterface $loop) { public function handleData($stream) { - $data = stream_get_contents($stream); + $data = fread($stream, $this->bufferSize); + $meta = stream_get_meta_data($stream); $this->emit('data', [$data, $this]); - if (!is_resource($stream) || feof($stream)) { + if (!is_resource($stream) || $meta['eof']) { $this->end(); } }