]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
Continued with refactoring:
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index 83ca2a85d0436c569a644d9bbbbb2feac4efa63a..4561e08e22fa0708690fb77922f3e5e22c94388a 100644 (file)
@@ -528,13 +528,19 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                // And make sure it is valid
                assert($helperInstance instanceof ConnectionHelper);
 
+               // Get connection info class
+               $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance();
+
+               // Will the info instance with connection helper data
+               $infoInstance->fillWithConnectionHelperInformation($helperInstance);
+
                // Is it not there?
-               if ((is_resource($socketResource)) && (!$registryInstance->isSocketRegistered($helperInstance, $socketResource))) {
+               if ((is_resource($socketResource)) && (!$registryInstance->isSocketRegistered($infoInstance, $socketResource))) {
                        // Debug message
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Registering socket ' . $socketResource . ' ...');
 
                        // Then register it
-                       $registryInstance->registerSocket($helperInstance, $socketResource, $packageData);
+                       $registryInstance->registerSocket($infoInstance, $socketResource, $packageData);
                } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) {
                        // Is not connected, then we cannot send
                        self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.');
@@ -572,6 +578,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                // Get the right connection instance
                $helperInstance = SocketRegistryFactory::createSocketRegistryInstance()->getHandlerInstanceFromPackageData($packageData);
 
+               // Test helper instance
+               assert($helperInstance instanceof ConnectionHelper);
+
                // Is this connection still alive?
                if ($helperInstance->isShuttedDown()) {
                        // This connection is shutting down