From: Roland Häder Date: Tue, 7 Aug 2012 16:11:18 +0000 (+0000) Subject: Do not call handlePackageByUnhandledPackage() directly, this caused decoding of alrea... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0afd1e46897791d26aba746b1e8f601bd0769b47;p=hub.git Do not call handlePackageByUnhandledPackage() directly, this caused decoding of already decoded data --- diff --git a/application/hub/main/package/assembler/class_PackageAssembler.php b/application/hub/main/package/assembler/class_PackageAssembler.php index f69ca26f9..641204f23 100644 --- a/application/hub/main/package/assembler/class_PackageAssembler.php +++ b/application/hub/main/package/assembler/class_PackageAssembler.php @@ -152,20 +152,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable /* 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 '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_RAW_DATA]); - - // Now get a chunk handler instance - $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance(); - - // Add all chunks because the last final chunk is found - $handlerInstance->addAllChunksWithFinal($chunks); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('packageContent=' . print_r($packageContent,true) . ',chunks='.print_r($chunks,true)); } } @@ -207,8 +194,18 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable // Debug message /* 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); + /* + * "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_RAW_DATA]); + + // Now get a chunk handler instance + $handlerInstance = ChunkHandlerFactory::createChunkHandlerInstance(); + + // Add all chunks because the last final chunk is found + $handlerInstance->addAllChunksWithFinal($chunks); } }