Skip to content

Commit

Permalink
Do not flash huge frames in nonblock mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Enelar committed Sep 23, 2016
1 parent c1a151b commit 9d041f4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class Base {
protected $socket, $is_connected = false, $is_closing = false, $last_opcode = null,
$close_status = null, $huge_payload = null;
$close_status = null, $huge_payload = '';

protected static $opcodes = array(
'continuation' => 0,
Expand Down Expand Up @@ -137,8 +137,6 @@ protected function send_fragment($final, $payload, $opcode, $masked) {
public function receive($try = false) {
if (!$this->is_connected) $this->connect(); /// @todo This is a client function, fixme!

$this->huge_payload = '';

$response = null;
do {
$response = $this->receive_fragment();
Expand Down Expand Up @@ -285,7 +283,7 @@ protected function receive_fragment() {
else if ($this->huge_payload) {
// sp we need to retreive the whole payload
$payload = $this->huge_payload .= $payload;
$this->huge_payload = null;
$this->huge_payload = '';
}

return $payload;
Expand Down

0 comments on commit 9d041f4

Please sign in to comment.