]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/class_NetworkPackage.php
Lesser noisy debug messages + updated 'core'.
[hub.git] / application / hub / main / package / class_NetworkPackage.php
index 4561e08e22fa0708690fb77922f3e5e22c94388a..d8d7e090b04779480adadf7b1e5db4f0d1cc88df 100644 (file)
@@ -529,7 +529,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                assert($helperInstance instanceof ConnectionHelper);
 
                // Get connection info class
-               $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance();
+               $infoInstance = ConnectionInfoFactory::createConnectionInfoInstance($helperInstance->getProtocolName(), 'helper');
 
                // Will the info instance with connection helper data
                $infoInstance->fillWithConnectionHelperInformation($helperInstance);
@@ -576,10 +576,18 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                $sentBytes = 0;
 
                // Get the right connection instance
-               $helperInstance = SocketRegistryFactory::createSocketRegistryInstance()->getHandlerInstanceFromPackageData($packageData);
+               $infoInstance = SocketRegistryFactory::createSocketRegistryInstance()->getInfoInstanceFromPackageData($packageData);
 
                // Test helper instance
+               assert($infoInstance instanceof ShareableInfo);
+
+               // Get helper instance
+               $helperInstance = $infoInstance->getHelperInstance();
+
+               // Some sanity-checks on the object
+               //* DEBUG-DIE: */ die('[' . __METHOD__ . ':' . __LINE__ . ']: p1=' . $infoInstance->getProtocolName() . ',p2=' . $helperInstance->getProtocolName() . ',infoInstance=' . print_r($infoInstance, TRUE));
                assert($helperInstance instanceof ConnectionHelper);
+               assert($infoInstance->getProtocolName() == $helperInstance->getProtocolName());
 
                // Is this connection still alive?
                if ($helperInstance->isShuttedDown()) {
@@ -819,7 +827,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        public function sendWaitingPackage () {
                // Debug message
-               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!');
 
                // Sanity check if we have packages waiting for delivery
                if (!$this->isPackageWaitingForDelivery()) {
@@ -846,7 +854,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                }
 
                // Debug message
-               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!');
        }
 
        /**
@@ -856,7 +864,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        public function sendEncodedData () {
                // Debug message
-               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!');
 
                // Make sure there is pending encoded data
                assert($this->isEncodedDataPending());
@@ -919,7 +927,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                $this->getStackInstance()->pushNamed(self::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray);
 
                // Debug message
-               /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!');
        }
 
        ///////////////////////////////////////////////////////////////////////////