From a456c50df437616648d45a73c711d78804ded21d Mon Sep 17 00:00:00 2001 From: Gerrit Drost Date: Fri, 23 May 2014 16:20:27 +0200 Subject: [PATCH] Reverted the changes previously made in favor of a different approach as requested in https://github.com/cboden/Ratchet/pull/188 --- src/Ratchet/App.php | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/Ratchet/App.php b/src/Ratchet/App.php index 229a448..5cafeae 100644 --- a/src/Ratchet/App.php +++ b/src/Ratchet/App.php @@ -1,5 +1,7 @@ routes = new RouteCollection; $this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop); - if ($flashAllowedHosts === false) { - $flashAllowedHosts = array( 80 => $httpHost ); - } - $policy = new FlashPolicy(); - - foreach ($flashAllowedHosts as $flashAllowedHost => $flashAllowedPort) { - $policy->addAllowedAccess($flashAllowedHost, $flashAllowedPort); - } - + $policy->addAllowedAccess($httpHost, 80); + $policy->addAllowedAccess($httpHost, $port); $flashSock = new Reactor($loop); - $this->flashServer = new IoServer($policy, $flashSock); - $flashSock->listen($flashPort, $flashAddress); + + if (80 == $port) { + $flashSock->listen(843, '0.0.0.0'); + } else { + $flashSock->listen(8843); + } + } + + /** + * Returns the FlashPolicy running in the FlashServer. Modifications of this object take effect immediately! + * + * @return FlashPolicy + */ + public function getFlashPolicy() { + return $this->flashServer->getApp(); } /** @@ -136,3 +140,4 @@ class App { $this->_server->run(); } } +