From 0caa6e814b87b1a36b81f462170fead953edb05b Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Mon, 21 May 2012 13:16:33 -0400 Subject: [PATCH] Minor cleanups --- MessageParser.php | 2 ++ Version/RFC6455/Message.php | 1 - WsServer.php | 15 ++------------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/MessageParser.php b/MessageParser.php index 11fc388..017c4f5 100644 --- a/MessageParser.php +++ b/MessageParser.php @@ -15,6 +15,8 @@ class MessageParser { $from->WebSocket->frame->addBuffer($data); if ($from->WebSocket->frame->isCoalesced()) { if ($from->WebSocket->frame->getOpcode() > 2) { + // take action on the control frame + unset($from->WebSocket->frame); return; diff --git a/Version/RFC6455/Message.php b/Version/RFC6455/Message.php index 5385475..1071115 100644 --- a/Version/RFC6455/Message.php +++ b/Version/RFC6455/Message.php @@ -35,7 +35,6 @@ class Message implements MessageInterface { /** * {@inheritdoc} - * @todo Should I allow addFrame if the frame is not coalesced yet? I believe I'm assuming this class will only receive fully formed frame messages * @todo Also, I should perhaps check the type...control frames (ping/pong/close) are not to be considered part of a message */ public function addFrame(FrameInterface $fragment) { diff --git a/WsServer.php b/WsServer.php index b7a85fc..40c3973 100644 --- a/WsServer.php +++ b/WsServer.php @@ -17,6 +17,7 @@ class WsServer implements MessageComponentInterface { * Negotiates upgrading the HTTP connection to a WebSocket connection * It contains useful configuration properties and methods * @var HandshakeNegotiator + * @note May not expose this in the future, may do through facade methods */ public $handshaker; @@ -36,18 +37,6 @@ class WsServer implements MessageComponentInterface { */ protected $messager; - /** - * Re-entrant instances of protocol version classes - * @internal - */ - protected $_versions = array( - 'HyBi10' => null - , 'Hixie76' => null - , 'RFC6455' => null - ); - - protected $_mask_payload = false; - /** * For now, array_push accepted subprotocols to this array * @deprecated @@ -177,6 +166,6 @@ class WsServer implements MessageComponentInterface { } } - return substr($string, 0, -1); + return mb_substr($string, 0, -1, 'ASCII'); } } \ No newline at end of file