From: Roland Haeder Date: Sun, 16 Feb 2014 01:11:43 +0000 (+0100) Subject: Commented more debug lines out and other cleanups. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b835be855f4df8f66e78114357fae18ba95bbcff;p=hub.git Commented more debug lines out and other cleanups. Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/decoder/package/class_PackageDecoder.php b/application/hub/main/decoder/package/class_PackageDecoder.php index e8010141e..759fed315 100644 --- a/application/hub/main/decoder/package/class_PackageDecoder.php +++ b/application/hub/main/decoder/package/class_PackageDecoder.php @@ -90,16 +90,22 @@ class PackageDecoder extends BaseDecoder implements Decodeable { $rawPackageContent = $this->getHandlerInstance()->getStackerInstance()->popNamed(ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: Got ' . strlen($rawPackageContent) . ' bytes from stack ' . ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA . ', decoding it ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: Got ' . strlen($rawPackageContent) . ' bytes from stack ' . ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA . ', decoding it ...'); // "Decode" the raw package content by using the NetworkPackage instance $decodedData = $this->getPackageInstance()->decodeRawContent($rawPackageContent); // Some checks - assert(is_array($decodedData)); + assert( + (is_array($decodedData)) && + (isset($decodedData[NetworkPackage::PACKAGE_DATA_SENDER])) && + (isset($decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) && + (isset($decodedData[NetworkPackage::PACKAGE_DATA_CONTENT])) && + (isset($decodedData[NetworkPackage::PACKAGE_DATA_STATUS])) + ); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); // Next get a recipient-discovery instance $discoveryInstance = PackageDiscoveryFactory::createPackageDiscoveryInstance(); @@ -110,7 +116,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable { // Check for 'recipient' field (the 'sender' field and others are ignored here) if ($discoveryInstance->isRecipientListEmpty()) { // The recipient is this node so next stack it on 'decoded_package' - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: Pushing ' . strlen($decodedData) . ' bytes to stack ' . self::STACKER_NAME_DECODED_PACKAGE . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: Pushing ' . strlen($decodedData) . ' bytes to stack ' . self::STACKER_NAME_DECODED_PACKAGE . ' ...'); $this->getHandlerInstance()->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_PACKAGE, $decodedData); } else { // Forward the package to the next node @@ -144,7 +150,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable { $decodedData = $this->getHandlerInstance()->getStackerInstance()->popNamed(self::STACKER_NAME_DECODED_PACKAGE); // Handle it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: decodedData()=' . strlen($decodedData)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); $this->getPackageInstance()->handleRawData($decodedData); } }