From 5fe8700eea7604eba56add17bcff8c50d8c3d369 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 4 Aug 2012 23:30:35 +0000 Subject: [PATCH] Renamed more ... --- .../package/assembler/class_Assembler.php | 2 +- .../network/class_BaseRawDataHandler.php | 4 ++-- .../assembler/class_PackageAssembler.php | 24 +++++++++---------- .../hub/main/package/class_NetworkPackage.php | 8 +++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/application/hub/interfaces/package/assembler/class_Assembler.php b/application/hub/interfaces/package/assembler/class_Assembler.php index a5fbcdef7..0212ad01b 100644 --- a/application/hub/interfaces/package/assembler/class_Assembler.php +++ b/application/hub/interfaces/package/assembler/class_Assembler.php @@ -26,7 +26,7 @@ interface Assembler extends FrameworkInterface { * Chunks the content from $packageContent and feeds it into another queue * for verification and possible re-requesting. * - * @param $packageContent An array with two elements: 'decoded_data' and 'error_code' + * @param $packageContent An array with two elements: 'raw_data' and 'error_code' * @return void */ function chunkPackageContent (array $packageContent); diff --git a/application/hub/main/handler/network/class_BaseRawDataHandler.php b/application/hub/main/handler/network/class_BaseRawDataHandler.php index d7e067dcb..331f160fe 100644 --- a/application/hub/main/handler/network/class_BaseRawDataHandler.php +++ b/application/hub/main/handler/network/class_BaseRawDataHandler.php @@ -45,8 +45,8 @@ class BaseRawDataHandler extends BaseHandler { const PACKAGE_LEVEL_CHECK_OKAY = 'checked_package'; // Package is fine // Package data - const PACKAGE_DECODED_DATA = 'decoded_data'; - const PACKAGE_ERROR_CODE = 'error_code'; + const PACKAGE_RAW_DATA = 'raw_data'; + const PACKAGE_ERROR_CODE = 'error_code'; /** * Stacker for raw data diff --git a/application/hub/main/package/assembler/class_PackageAssembler.php b/application/hub/main/package/assembler/class_PackageAssembler.php index 9b1b2bdee..ab4d468db 100644 --- a/application/hub/main/package/assembler/class_PackageAssembler.php +++ b/application/hub/main/package/assembler/class_PackageAssembler.php @@ -74,12 +74,12 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable /** * Checks whether given package content is completed (start/end markers are found) * - * @param $packageContent An array with two elements: 'decoded_data' and 'error_code' + * @param $packageContent An array with two elements: 'raw_data' and 'error_code' * @return $isCompleted Whether the given package content is completed */ private function isPackageContentCompleted (array $packageContent) { // Check both - $isCompleted = ((substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], 0, 5) == '[[S]]') && (substr($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA], -5, 5) == '[[E]]')); + $isCompleted = ((substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, 5) == '[[S]]') && (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -5, 5) == '[[E]]')); // Return status return $isCompleted; @@ -95,14 +95,14 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable * chunks and (maybe) re-request some chunks from the sender, this would * take to much time and therefore slow down this node again. * - * @param $packageContent An array with two elements: 'decoded_data' and 'error_code' + * @param $packageContent An array with two elements: 'raw_data' and 'error_code' * @return void * @throws UnsupportedPackageCodeHandlerException If the package code handler is not implemented */ public function chunkPackageContent (array $packageContent) { // Validate the package content array again assert( - (isset($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA])) && + (isset($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA])) && (isset($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE])) ); @@ -129,31 +129,31 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable * some low checks on it and feeds it into another queue for verification * and re-request for bad chunks. * - * @param $packageContent An array with two elements: 'decoded_data' and 'error_code' + * @param $packageContent An array with two elements: 'raw_data' and 'error_code' * @return void * @throws FinalChunkVerificationException If the final chunk does not start with 'EOP:' */ private function handlePackageByUnhandledPackage (array $packageContent) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_DECODED_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_RAW_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); // Check for some conditions if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageContent))) { // Last chunk is not valid, so wait for more - $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]; + $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]; // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]) . ' bytes)'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)'); } else { // Debug message //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('packageContent=' . print_r($packageContent,true) . ',chunks='.print_r($chunks,true)); /* - * "explode" the string from 'decoded_data' with chunk separator to + * "explode" the string from 'raw_data' with chunk separator to * get an array of chunks. These chunks must then be verified by * their checksums. Also the final chunk must be handled. */ - $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]); + $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); // Now get a chunk handler instance $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance(); @@ -188,7 +188,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable // Init fake array $packageContent = array( - BaseRawDataHandler::PACKAGE_DECODED_DATA => $this->pendingData, + BaseRawDataHandler::PACKAGE_RAW_DATA => $this->pendingData, BaseRawDataHandler::PACKAGE_ERROR_CODE => BaseRawDataHandler::SOCKET_ERROR_UNHANDLED ); @@ -196,7 +196,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable $this->pendingData = ''; // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]) . ' bytes has been received.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.'); // Call the real handler method $this->handlePackageByUnhandledPackage($packageContent); diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index 1a5a8d46e..a116d7cec 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -824,7 +824,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Make sure both array elements are there assert( (is_array($decodedData)) && - (isset($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA])) && + (isset($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA])) && (isset($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE])) ); @@ -836,9 +836,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == BaseRawDataHandler::SOCKET_ERROR_UNHANDLED); // Remove the last chunk SEPARATOR (because it is being added and we don't need it) - if (substr($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { + if (substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { // It is there and should be removed - $decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_DECODED_DATA], 0, -1); + $decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1); } // END - if // This package is "handled" and can be pushed on the next stack @@ -854,7 +854,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R public function addRawDataToIncomingStack (Networkable $handlerInstance) { /* * Get the decoded data from the handler, this is an array with - * 'decoded_data' and 'error_code' as elements. + * 'raw_data' and 'error_code' as elements. */ $decodedData = $handlerInstance->getNextRawData(); -- 2.39.5