]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/package/assembler/class_PackageAssembler.php
Renamed more ...
[hub.git] / application / hub / main / package / assembler / class_PackageAssembler.php
index 9b1b2bdeeff79c818495697dba0f3fc156327bf9..ab4d468dbdaf1f36da20e8110281ab91e819f21d 100644 (file)
@@ -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);