X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fregistry%2Fsocket%2Fclass_SocketRegistry.php;h=bc72879d039b4419abf11d7bf20b69fc5e42f5f2;hb=f884d1738b81b893f44001100f51661f307ad9a3;hp=60c8059711eb0ca8fb0e89b640d6dd24fa2e291b;hpb=3702d6e3f543a30966f23ef978dfdb9a5cbdebbe;p=hub.git diff --git a/application/hub/main/registry/socket/class_SocketRegistry.php b/application/hub/main/registry/socket/class_SocketRegistry.php index 60c805971..bc72879d0 100644 --- a/application/hub/main/registry/socket/class_SocketRegistry.php +++ b/application/hub/main/registry/socket/class_SocketRegistry.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -28,7 +28,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke /** * Instance of this class */ - private static $registryInstance = null; + private static $registryInstance = NULL; /** * Protected constructor @@ -45,7 +45,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * * @return $registryInstance An instance of this class */ - public final static function createSocketRegistry () { + public static final function createSocketRegistry () { // Is an instance there? if (is_null(self::$registryInstance)) { // Not yet, so create one @@ -150,7 +150,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke // Is the socket already registered? if ($this->isSocketRegistered($protocolInstance, $socketResource)) { // Throw the exception - throw new SocketAlreadyRegisteredException($protocolInstance, BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED); + throw new SocketAlreadyRegisteredException(array($protocolInstance, $socketResource), BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED); } // END - if // Does the instance exist? @@ -172,6 +172,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketInstance = ObjectFactory::CreateObjectByConfiguredName('socket_container_class', array($socketResource, $protocolInstance, $packageData)); // We have a sub-registry, the socket key and the socket, now we need to put all together + /* DEBUG: */ $this->debugOutput('SOCKET-REGISTRY: socketKey=' . $socketKey . ',socketResource=' . $socketResource . ' - adding socket container instance ...'); $registryInstance->addInstance($socketKey, $socketInstance); } @@ -213,15 +214,15 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function getHandlerInstanceFromPackageData (array $packageData) { // Init protocol instance - $protocolInstance = null; + $protocolInstance = NULL; // Get all keys and check them foreach ($this->getInstanceRegistry() as $key=>$registryInstance) { // This is always a SubRegistry instance foreach ($registryInstance->getInstanceRegistry() as $subKey=>$containerInstance) { // This is a SocketContainer instance, so does the recipient match? - if ($containerInstance->ifAddressMatches($packageData['recipient'])) { - // Found one, so get the protocol instance and abort + if ($containerInstance->ifAddressMatches($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) { + // Found one, so get the protocol instance and abort any further search $protocolInstance = $containerInstance->getProtocolInstance(); break; } // END - if