Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Commit

Permalink
Refs #18 : split the packet in case of its length > 16kb
Browse files Browse the repository at this point in the history
  • Loading branch information
Taluu committed Aug 13, 2014
1 parent e05d5d2 commit 6857f9f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Engine/AbstractSocketIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,14 @@ public function read()
$data .= fread($this->stream, 4);
}

// Split the packet in case of the length > 16kb
while ($length > 0 && $buffer = fread($this->stream, $length)) {
$data .= $buffer;
$length -= strlen($buffer);
}

// decode the payload
return (string) new Decoder($data . fread($this->stream, $length));
return (string) new Decoder($data);
}

/** {@inheritDoc} */
Expand Down

0 comments on commit 6857f9f

Please sign in to comment.