X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fpackage%2Fclass_NetworkPackage.php;h=a08a1dc5524746d9b0bd9d61fa3874c1d02e1792;hb=aaea57bc3f64734a41670a779628a551d555dab4;hp=8202882765292c418c6ab15400a602488d66d413;hpb=df030ed5e35a394da292188307e40eb8d8779509;p=hub.git diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index 820288276..a08a1dc55 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -15,11 +15,11 @@ * For performance reasons, this class should only be instanciated once and then * used as a "pipe-through" class. * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.org * @todo Needs to add functionality for handling the object's type * * This program is free software: you can redistribute it and/or modify @@ -256,7 +256,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $packageInstance->setStackerInstance($stackerInstance); // Init all stacker - $packageInstance->initStackers(); + $packageInstance->initStacks(); // Get a visitor instance for speeding up things and set it $visitorInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_monitor_visitor_class', array($packageInstance)); @@ -280,23 +280,19 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * @param $forceReInit Whether to force reinitialization of all stacks * @return void */ - protected function initStackers ($forceReInit = FALSE) { + protected function initStacks ($forceReInit = FALSE) { // Initialize all - foreach ( - array( - self::STACKER_NAME_UNDECLARED, - self::STACKER_NAME_DECLARED, - self::STACKER_NAME_OUTGOING, - self::STACKER_NAME_DECODED_INCOMING, - self::STACKER_NAME_DECODED_HANDLED, - self::STACKER_NAME_DECODED_CHUNKED, - self::STACKER_NAME_NEW_MESSAGE, - self::STACKER_NAME_PROCESSED_MESSAGE, - self::STACKER_NAME_BACK_BUFFER - ) as $stackerName) { - // Init this stacker - $this->getStackerInstance()->initStacker($stackerName, $forceReInit); - } // END - foreach + $this->getStackerInstance()->initStacks(array( + self::STACKER_NAME_UNDECLARED, + self::STACKER_NAME_DECLARED, + self::STACKER_NAME_OUTGOING, + self::STACKER_NAME_DECODED_INCOMING, + self::STACKER_NAME_DECODED_HANDLED, + self::STACKER_NAME_DECODED_CHUNKED, + self::STACKER_NAME_NEW_MESSAGE, + self::STACKER_NAME_PROCESSED_MESSAGE, + self::STACKER_NAME_BACK_BUFFER + ), $forceReInit); } /** @@ -307,11 +303,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function getHashFromContent ($content) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); // Create the hash - // @TODO crc32() is very weak, but it needs to be fast - $hash = crc32( + // @TODO md5() is very weak, but it needs to be fast + $hash = md5( $content . self::PACKAGE_CHECKSUM_SEPARATOR . $this->getSessionId() . @@ -320,7 +316,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',hash=' . $hash . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',hash=' . $hash . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); // And return it return $hash; @@ -381,11 +377,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function getHashFromContentSessionId (array $decodedContent, $sessionId) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: content[md5]=' . md5($decodedContent[self::PACKAGE_CONTENT_MESSAGE]) . ',sender=' . $sessionId . ',compressor=' . $decodedContent[self::PACKAGE_CONTENT_EXTENSION]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: content[md5]=' . md5($decodedContent[self::PACKAGE_CONTENT_MESSAGE]) . ',sender=' . $sessionId . ',compressor=' . $decodedContent[self::PACKAGE_CONTENT_EXTENSION]); // Create the hash - // @TODO crc32() is very weak, but it needs to be fast - $hash = crc32( + // @TODO md5() is very weak, but it needs to be fast + $hash = md5( $decodedContent[self::PACKAGE_CONTENT_MESSAGE] . self::PACKAGE_CHECKSUM_SEPARATOR . $sessionId . @@ -408,6 +404,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * @return void */ private function declareRawPackageData (array $packageData) { + // Make sure the required field is there + assert(isset($packageData[self::PACKAGE_DATA_RECIPIENT])); + /* * We need to disover every recipient, just in case we have a * multi-recipient entry like 'upper' is. 'all' may be a not so good @@ -431,7 +430,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $currentRecipient = $iteratorInstance->current(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Setting recipient to ' . $currentRecipient . ',previous=' . $packageData[self::PACKAGE_DATA_RECIPIENT]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Setting recipient to ' . $currentRecipient . ',previous=' . $packageData[self::PACKAGE_DATA_RECIPIENT]); // Set the recipient $packageData[self::PACKAGE_DATA_RECIPIENT] = $currentRecipient; @@ -440,7 +439,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECLARED, $packageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Package declared for recipient ' . $currentRecipient); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Package declared for recipient ' . $currentRecipient); // Skip to next entry $iteratorInstance->next(); @@ -482,7 +481,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $socketResource = $discoveryInstance->discoverSocket($packageData, BaseConnectionHelper::CONNECTION_TYPE_OUTGOING); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); // We have to put this socket in our registry, so get an instance $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); @@ -491,38 +490,38 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $helperInstance = Registry::getRegistry()->getInstance('connection'); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: stateInstance=' . $helperInstance->getStateInstance()); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: stateInstance=' . $helperInstance->getStateInstance()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); // Is it not there? if ((is_resource($socketResource)) && (!$registryInstance->isSocketRegistered($helperInstance, $socketResource))) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Registering socket ' . $socketResource . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Registering socket ' . $socketResource . ' ...'); // Then register it $registryInstance->registerSocket($helperInstance, $socketResource, $packageData); } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) { // Is not connected, then we cannot send - self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); // Shutdown the socket $this->shutdownSocket($socketResource); } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Reached line ' . __LINE__ . ' after isSocketRegistered() has been called.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' after isSocketRegistered() has been called.'); // Make sure the connection is up $helperInstance->getStateInstance()->validatePeerStateConnected(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Reached line ' . __LINE__ . ' after validatePeerStateConnected() has been called.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' after validatePeerStateConnected() has been called.'); // Enqueue it again on the out-going queue, the connection is up and working at this point $this->getStackerInstance()->pushNamed(self::STACKER_NAME_OUTGOING, $packageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Reached line ' . __LINE__ . ' after pushNamed() has been called.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' after pushNamed() has been called.'); } /** @@ -561,7 +560,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function generatePackageSignature ($content, $senderId) { // Hash content and sender id together, use md5() as last algo - $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getPrivateKey(), false)); + $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getPrivateKey(), FALSE)); // Encrypt the content again with the hash as a key $encryptedContent = $this->getCryptoInstance()->encryptString($content, $hash); @@ -587,7 +586,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Is it the same? //$isSignatureValid = - exit(__METHOD__.': signature='.$signature.chr(10).',decodedArray='.print_r($decodedArray,true)); + exit(__METHOD__.': signature='.$signature.chr(10).',decodedArray='.print_r($decodedArray, TRUE)); } /** @@ -689,7 +688,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Make sure this method isn't working if there is no package enqueued if (!$this->isPackageEnqueued()) { // This is not fatal but should be avoided - // @TODO Add some logging here + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No raw package data waiting declaration, but ' . __METHOD__ . ' has been called!'); return; } // END - if @@ -697,13 +696,10 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * Now there are for sure packages to deliver, so start with the first * one. */ - $packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_UNDECLARED); + $packageData = $this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED); // Declare the raw package data for delivery $this->declareRawPackageData($packageData); - - // And remove it finally - $this->getStackerInstance()->popNamed(self::STACKER_NAME_UNDECLARED); } /** @@ -717,13 +713,17 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Sanity check if we have packages declared if (!$this->isPackageDeclared()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: No package has been declared, but ' . __METHOD__ . ' has been called!'); + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No package has been declared, but ' . __METHOD__ . ' has been called!'); return; } // END - if // Get the package $packageData = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECLARED); + // Assert on it + assert(isset($packageData[self::PACKAGE_DATA_RECIPIENT])); + + // Try to deliver the package try { // And try to send it $this->deliverRawPackageData($packageData); @@ -732,7 +732,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECLARED); } catch (InvalidStateException $e) { // The state is not excepected (shall be 'connected') - self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); // Mark the package with status failed $this->changePackageStatus($packageData, self::STACKER_NAME_DECLARED, self::PACKAGE_STATUS_FAILED); @@ -751,7 +751,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Sanity check if we have packages waiting for delivery if (!$this->isPackageWaitingForDelivery()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: No package is waiting for delivery, but ' . __METHOD__ . ' was called.'); + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No package is waiting for delivery, but ' . __METHOD__ . ' was called.'); return; } // END - if @@ -766,7 +766,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackerInstance()->popNamed(self::STACKER_NAME_OUTGOING); } catch (InvalidSocketException $e) { // Output exception message - self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Package was not delivered: ' . $e->getMessage()); + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Package was not delivered: ' . $e->getMessage()); // Mark package as failed $this->changePackageStatus($packageData, self::STACKER_NAME_OUTGOING, self::PACKAGE_STATUS_FAILED); @@ -821,12 +821,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ if (!$this->isRawDataPending()) { // This is not fatal but should be avoided - // @TODO Add some logging here + self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No raw (decoded?) data is pending, but ' . __METHOD__ . ' has been called!'); return; } // END - if // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: Stacker size is ' . $this->getStackerInstance()->getStackCount(self::STACKER_NAME_DECODED_INCOMING) . ' entries.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Stacker size is ' . $this->getStackerInstance()->getStackCount(self::STACKER_NAME_DECODED_INCOMING) . ' entries.'); // "Pop" the next entry (the same array again) from the stack $decodedData = $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECODED_INCOMING); @@ -842,7 +842,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * Also make sure the error code is SOCKET_ERROR_UNHANDLED because we * only want to handle unhandled packages here. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . BaseRawDataHandler::SOCKET_ERROR_UNHANDLED . ')'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . BaseRawDataHandler::SOCKET_ERROR_UNHANDLED . ')'); 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) @@ -852,6 +852,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // END - if // This package is "handled" and can be pushed on the next stack + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Pushing ' . strlen($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes to stack ' . self::STACKER_NAME_DECODED_HANDLED . ' ...'); $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_HANDLED, $decodedData); } @@ -869,7 +870,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $decodedData = $handlerInstance->getNextRawData(); // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, true)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, TRUE)); // And push it on our stack $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_INCOMING, $decodedData); @@ -926,6 +927,13 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Get current package content (an array with two elements; see handleIncomingDecodedData() for details) $packageContent = $this->getStackerInstance()->getNamed(self::STACKER_NAME_DECODED_HANDLED); + // Assert on some elements + assert( + (is_array($packageContent)) && + (isset($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA])) && + (isset($packageContent[BaseRawDataHandler::PACKAGE_ERROR_CODE])) + ); + // Start assembling the raw package data array by chunking it $this->getAssemblerInstance()->chunkPackageContent($packageContent); @@ -933,6 +941,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackerInstance()->popNamed(self::STACKER_NAME_DECODED_HANDLED); // ... and push it on the 'chunked' stacker + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Pushing ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes on stack ' . self::STACKER_NAME_DECODED_CHUNKED . ' ...'); $this->getStackerInstance()->pushNamed(self::STACKER_NAME_DECODED_CHUNKED, $packageContent); } @@ -944,26 +953,26 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - START'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - START'); // Visit the package $visitorInstance->visitNetworkPackage($this); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - FINISHED'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - FINISHED'); } /** - * Clears all stacker + * Clears all stacks * * @return void */ - public function clearAllStacker () { + public function clearAllStacks () { // Call the init method to force re-initialization - $this->initStackers(true); + $this->initStacks(TRUE); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: All stacker have been re-initialized.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: All stacker have been re-initialized.'); } /** @@ -1134,7 +1143,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $messageArray[self::MESSAGE_ARRAY_DATA][self::MESSAGE_ARRAY_TYPE] = $messageArray[self::MESSAGE_ARRAY_TYPE]; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __LINE__ . ']: messageArray=' . print_r($messageArray, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: messageArray=' . print_r($messageArray, TRUE)); // Create a handler instance from given message type $handlerInstance = MessageTypeHandlerFactory::createMessageTypeHandlerInstance($messageArray[self::MESSAGE_ARRAY_TYPE]);