From b05552b219ce868057938d33c0f7579182c6f0b6 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Thu, 7 Jun 2012 09:05:36 -0400 Subject: [PATCH] Revert "[WebSocket] Frame concatenation" This reverts commit 53354cd967d60115f9ab2bd833d3b0650bbd175c. --- Version/Hixie76/Frame.php | 4 ---- Version/RFC6455/Frame.php | 24 +----------------------- WsServer.php | 3 --- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/Version/Hixie76/Frame.php b/Version/Hixie76/Frame.php index c9d0ec6..b9af87d 100644 --- a/Version/Hixie76/Frame.php +++ b/Version/Hixie76/Frame.php @@ -75,8 +75,4 @@ class Frame implements FrameInterface { return substr($this->_data, 1, strlen($this->_data) - 2); } - - public function extractOverflow() { - return ''; - } } \ No newline at end of file diff --git a/Version/RFC6455/Frame.php b/Version/RFC6455/Frame.php index f8dc826..60c8a2f 100644 --- a/Version/RFC6455/Frame.php +++ b/Version/RFC6455/Frame.php @@ -38,7 +38,7 @@ class Frame implements FrameInterface { return false; } - return $this->_bytes_rec >= $payload_length + $payload_start; + return $payload_length + $payload_start === $this->_bytes_rec; } /** @@ -223,26 +223,4 @@ class Frame implements FrameInterface { return $payload; } - - /** - * Sometimes clients will concatinate more than one frame over the wire - * This method will take the extra bytes off the end and return them - * @todo Consider returning new Frame - * @return string - */ - public function extractOverflow() { - if ($this->isCoalesced()) { - $endPoint = $this->getPayloadLength(); - $endPoint += $this->getPayloadStartingByte(); - - if ($this->_bytes_rec > $endPoint) { - $overflow = substr($this->_data, $endPoint); - $this->_data = substr($this->_data, 0, $endPoint); - - return $overflow; - } - } - - return ''; - } } \ No newline at end of file diff --git a/WsServer.php b/WsServer.php index 951a4d8..b69119c 100644 --- a/WsServer.php +++ b/WsServer.php @@ -122,10 +122,7 @@ class WsServer implements MessageComponentInterface { // Control frames (ping, pong, close) can be sent in between a fragmented message $from->WebSocket->message->addFrame($from->WebSocket->frame); - $nextFrame = $from->WebSocket->version->newFrame(); - $nextFrame->addBuffer($from->WebSocket->frame->extractOverflow()); unset($from->WebSocket->frame); - $from->WebSocket->frame = $nextFrame; } if ($from->WebSocket->message->isCoalesced()) {