From 447ec445d0342164ac4f0a141344d7760e3bf730 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 30 Jan 2015 01:33:06 +0100 Subject: [PATCH] Now use more the newly added (not here yet) ShareabeInfo instance. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../socket/class_RegisterableSocket.php | 8 +++---- .../socket/class_SocketContainer.php | 21 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/inc/classes/interfaces/registry/socket/class_RegisterableSocket.php b/inc/classes/interfaces/registry/socket/class_RegisterableSocket.php index 6e3e2be7..cd7c41cd 100644 --- a/inc/classes/interfaces/registry/socket/class_RegisterableSocket.php +++ b/inc/classes/interfaces/registry/socket/class_RegisterableSocket.php @@ -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] diff --git a/inc/classes/main/container/socket/class_SocketContainer.php b/inc/classes/main/container/socket/class_SocketContainer.php index 656f81d1..fd5cff11 100644 --- a/inc/classes/main/container/socket/class_SocketContainer.php +++ b/inc/classes/main/container/socket/class_SocketContainer.php @@ -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())); -- 2.39.5