]> git.mxchange.org Git - core.git/commitdiff
Now use more the newly added (not here yet) ShareabeInfo instance.
authorRoland Haeder <roland@mxchange.org>
Fri, 30 Jan 2015 00:33:06 +0000 (01:33 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 30 Jan 2015 00:33:34 +0000 (01:33 +0100)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/interfaces/registry/socket/class_RegisterableSocket.php
inc/classes/main/container/socket/class_SocketContainer.php

index 6e3e2be72b888b135e7b42325e113176b9351f96..cd7c41cd44e5f4788de6c3f4ef8c4d1681151c25 100644 (file)
@@ -52,12 +52,12 @@ interface RegisterableSocket extends Registerable {
        function getRegisteredSocketResource (Listenable $listenerInstance);
 
        /**
-        * "Getter" for protocol/connection instance from given package data
+        * "Getter" for info instance from given package data
         *
-        * @param       $packageData            Raw package data
-        * @return      $protocolInstance       An instance of a HandleableProtocol class
+        * @param       $packageData    Raw package data
+        * @return      $infoInstance   An instance of a ShareableInfo class
         */
-       function getHandlerInstanceFromPackageData (array $packageData);
+       function getInfoInstanceFromPackageData (array $packageData);
 }
 
 // [EOF]
index 656f81d12813d17cc6121e729bcd0bb7a608f099..fd5cff1126b0ce9e5f24e623bc4c00689e5eaa61 100644 (file)
@@ -53,14 +53,27 @@ class SocketContainer extends BaseContainer implements Registerable {
 
                // Is the info instance set?
                if ($infoInstance instanceof ShareableInfo) {
-                       // Get listener from info class
+                       // Get listener/helper from info class
                        $listenerInstance = $infoInstance->getListenerInstance();
+                       $helperInstance = $infoInstance->getHelperInstance();
+
+                       // Debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: listenerInstance[]=' . gettype($listenerInstance));
 
                        // Is there a listener instance set?
                        if ($listenerInstance instanceof Listenable) {
+                               // Debug message
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: Setting listenerInstance=' . $listenerInstance->__toString() . ' ...');
+
                                // Set it here for later usage
                                $containerInstance->setListenerInstance($listenerInstance);
-                       } // END - if
+                       } elseif ($helperInstance instanceof ConnectionHelper) {
+                               // Debug message
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: Setting helperInstance=' . $helperInstance->__toString() . ' ...');
+
+                               // Set it here for later usage
+                               $containerInstance->setHelperInstance($helperInstance);
+                       }
                } // END - if
 
                // Set the resource ...
@@ -84,7 +97,7 @@ class SocketContainer extends BaseContainer implements Registerable {
                $packageData = $this->getPackageData();
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER: unl=' . $unl . ',packageData=' . print_r($packageData, TRUE));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',packageData=' . print_r($packageData, TRUE));
 
                // So, does both match?
                $matches = ((isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) && ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] === $unl));
@@ -101,7 +114,7 @@ class SocketContainer extends BaseContainer implements Registerable {
         */
        public final function ifSocketResourceMatches ($socketResource) {
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource());
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource());
 
                // So, does both match?
                $matches = ((is_resource($socketResource)) && ($socketResource === $this->getSocketResource()));