From 4de9caaa78b6769d116181cd8095a79b3306754b Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Fri, 25 Nov 2011 09:41:11 -0500 Subject: [PATCH] Bug Fixes Fixed bug where WebSocket protocols were being created for every connection Enabled Garbage Collection in server --- lib/Ratchet/Application/Server/App.php | 1 + lib/Ratchet/Application/WebSocket/App.php | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Ratchet/Application/Server/App.php b/lib/Ratchet/Application/Server/App.php index 8f62237..4b2306a 100644 --- a/lib/Ratchet/Application/Server/App.php +++ b/lib/Ratchet/Application/Server/App.php @@ -70,6 +70,7 @@ class App implements ApplicationInterface { $this->_connections[$host->getResource()] = new Connection($host); $this->_resources[] = $host->getResource(); + gc_enable(); set_time_limit(0); ob_implicit_flush(); diff --git a/lib/Ratchet/Application/WebSocket/App.php b/lib/Ratchet/Application/WebSocket/App.php index 46aaba3..ed8b9f5 100644 --- a/lib/Ratchet/Application/WebSocket/App.php +++ b/lib/Ratchet/Application/WebSocket/App.php @@ -16,7 +16,6 @@ use Ratchet\Application\WebSocket\Version; * @todo Make sure this works both ways (client/server) as stack needs to exist on client for framing * @todo Learn about closing the socket. A message has to be sent prior to closing - does the message get sent onClose event or CloseConnection command? * @todo Consider chaning this class to a State Pattern. If a WS App interface is passed use different state for additional methods used - * @todo I think I need to overhaul the architecture of this...more onus should be on the VersionInterfaces in case of changes...let them handle more decisions, not just parsing */ class App implements ApplicationInterface, ConfiguratorInterface { /** @@ -206,8 +205,8 @@ class App implements ApplicationInterface, ConfiguratorInterface { } else { $ns = __NAMESPACE__ . "\\Version\\{$name}"; if ($ns::isProtocol($headers)) { - $this->_version[$name] = new $ns; - return $this->_version[$name]; + $this->_versions[$name] = new $ns; + return $this->_versions[$name]; } } }