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 6e3e2be..cd7c41c 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 656f81d..fd5cff1 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()));