From: Roland Häder Date: Sun, 15 Aug 2021 17:47:28 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bdf414deb0b309f001f0cce5dc461060201ffc71;p=hub.git Continued: - I still need to find the actual root cause why $infoInstance is set to NULL - so commented in some debug lines, replaced concat (.) with sprintf() (string mask). Yes, I know you don't like to read the 2nd word -> MASK! <- but it isn't my fault. So let's leave it there. Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index 48dc5edf6..a804df43c 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -292,53 +292,60 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke //* DEBUG-DIE: */ die(__METHOD__ . ':packageData=' . print_r($packageData, TRUE)); // Get all keys and check them + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: this->instanceRegistry()=%d', count($this->getInstanceRegistry()))); foreach ($this->getInstanceRegistry() as $key => $registryInstance) { // This is always a SubRegistry instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',registryInstance=' . $registryInstance->__toString()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,registryInstance=%s', $key, $registryInstance->__toString())); foreach ($registryInstance->getInstanceRegistry() as $subKey => $socketInstance) { // Is this a StorableSocket instance and is the address the same? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',socketInstance=' . $socketInstance->__toString()); - if (($socketInstance instanceof StorableSocket) && ($socketInstance->ifAddressMatches($packageInstance->getRecipientUnl()))) { + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,socketInstance=%s', $key, $subKey, $socketInstance->__toString())); + if ($socketInstance->ifAddressMatches($packageInstance->getRecipientUnl())) { // Get listener and helper instances - //* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Calling socketInstance->getListenerInstance() ...'); + /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s, calling socketInstance->getListenerInstance() ...', $key, $subKey)); //* DEBUG-DIE: */ die(__METHOD__ . ': socketInstance=' . print_r($socketInstance, TRUE)); $listenerInstance = $socketInstance->getListenerInstance(); $helperInstance = $socketInstance->getHelperInstance(); // Is a listener or helper set? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',listenerInstance[]=' . gettype($listenerInstance) . ',helperInstance[]=' . gettype($helperInstance)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,listenerInstance[]=%s,helperInstance[]=%s', $key, $subKey, gettype($listenerInstance), gettype($helperInstance))); if ($listenerInstance instanceof Listenable) { // Found a listener, so get the info instance first + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for listenerInstance->protocolName=%s ...', $key, $subKey, $listenerInstance->getProtocolName())); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($listenerInstance->getProtocolName(), 'helper'); // Fill info instance with listener data + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Calling infoInstance->fillWithListenerInformation(%s) ...', $key, $subKey, $listenerInstance->__toString())); $infoInstance->fillWithListenerInformation($listenerInstance); } elseif ($helperInstance instanceof ConnectionHelper) { // Found a helper, so get the info instance first + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Getting infoInstance for helperInstance->protocolName=%s ...', $key, $subKey, $helperInstance->getProtocolName())); $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($helperInstance->getProtocolName(), 'helper'); // Helper is found + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s: Calling infoInstance->fillWithHelperInformation(%s) ...', $key, $subKey, $helperInstance->__toString())); $infoInstance->fillWithConnectionHelperInformation($helperInstance); } else { // Not supported state! - $this->debugInstance(sprintf('[%s:%d]: Invalid script-state found, please report this to the developers with full debug infos. socketInstance=%s', __METHOD__, __LINE__, print_r($socketInstance, TRUE))); + $this->debugInstance(sprintf('[%s:%d]: Invalid script-state found, please report this to the developers with full debug infos. key=%s,subKey=%s,socketInstance=%s', __METHOD__, __LINE__, $key, $subKey, print_r($socketInstance, TRUE))); } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',infoInstance[' . gettype($infoInstance) . ']=' . $infoInstance->__toString() . ' with protocol ' . $infoInstance->getProtocolName() . ' - FOUND!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: key=%s,subKey=%s,infoInstance[%s]=%s with protocol %s - FOUND!', $key, $subKey, gettype($infoInstance), $infoInstance->__toString(), $infoInstance->getProtocolName())); break; } } // Is no longer NULL set? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance[]=%s', gettype($infoInstance))); if (!is_null($infoInstance)) { // Then skip here, too + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: BREAK!'); break; } } // Return the info instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: infoInstance[]=' . gettype($infoInstance) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: infoInstance[]=%s - EXIT!', gettype($infoInstance))); return $infoInstance; }