Skip to content

Commit e574f6f

Browse files
committed
Add extra guard which ends the Connection when eof is detected or the stream already has been closed
1 parent 2041d3d commit e574f6f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Devristo/Phpws/Protocol/WebSocketConnection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public function __construct($socket, LoopInterface $loop, $logger)
3232

3333
public function handleData($stream)
3434
{
35+
if (feof($stream) || !is_resource($stream)){
36+
$this->end();
37+
return;
38+
}
39+
3540
$data = fread($stream, $this->bufferSize);
3641
if ('' === $data || false === $data) {
3742
$this->end();

0 commit comments

Comments
 (0)