From 819e37ebfd3ece298d724e29d26fdafc824f4d95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 26 Oct 2020 17:45:36 +0100 Subject: [PATCH] Continued: - commented out noisy debug lines, still the unimplemented method in socket listener will flood output MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../classes/listener/class_BaseListener.php | 6 +- .../listener/class_BaseListenerDecorator.php | 8 +- .../package/deliverable/class_PackageData.php | 12 +-- .../fragmenter/class_PackageFragmenter.php | 82 +++++++++---------- .../registry/socket/class_SocketRegistry.php | 8 +- .../class_RawDataPoolMonitorVisitor.php | 4 +- 6 files changed, 58 insertions(+), 62 deletions(-) diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 5205df308..ec5c439ee 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -284,12 +284,12 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { */ public function monitorIncomingRawData () { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: CALLED!', strtoupper($this->getProtocolName()))); // Check if an incoming socket is registered if (!$this->getRegistryInstance()->isIncomingSocketRegistered()) { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No socket of type "%s" registered. - EXIT!', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: No socket of type "%s" registered. - EXIT!', strtoupper($this->getProtocolName()), StorableSocket::CONNECTION_TYPE_INCOMING)); // Skip further processing return; @@ -335,7 +335,7 @@ abstract class BaseListener extends BaseHubSystem implements Visitable { $iteratorInstance->next(); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER: EXIT!', strtoupper($this->getProtocolName()))); } /** diff --git a/application/hub/classes/listener/class_BaseListenerDecorator.php b/application/hub/classes/listener/class_BaseListenerDecorator.php index e4fcb578c..966d36e72 100644 --- a/application/hub/classes/listener/class_BaseListenerDecorator.php +++ b/application/hub/classes/listener/class_BaseListenerDecorator.php @@ -176,7 +176,7 @@ abstract class BaseListenerDecorator extends BaseDecorator implements Visitable */ public function monitorIncomingRawData () { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: CALLED!'); // Get the handler instance $handlerInstance = $this->getListenerInstance()->getHandlerInstance(); @@ -194,12 +194,12 @@ abstract class BaseListenerDecorator extends BaseDecorator implements Visitable } // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER-DECORATOR: handlerInstance=%s', strtoupper($this->getProtocolName()), $handlerInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-LISTENER-DECORATOR: handlerInstance=%s', strtoupper($this->getProtocolName()), $handlerInstance->__toString())); // Does the handler have some decoded data pending? if (!$handlerInstance->isRawDataPending()) { // No data is pending so skip further code silently - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!'); return; } // END - if @@ -217,7 +217,7 @@ abstract class BaseListenerDecorator extends BaseDecorator implements Visitable $receiverInstance->addRawDataToIncomingStack($handlerInstance); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER-DECORATOR: EXIT!'); } /** diff --git a/application/hub/classes/package/deliverable/class_PackageData.php b/application/hub/classes/package/deliverable/class_PackageData.php index 0dcbb84fd..f93693f0a 100644 --- a/application/hub/classes/package/deliverable/class_PackageData.php +++ b/application/hub/classes/package/deliverable/class_PackageData.php @@ -354,7 +354,7 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera */ public final function getAllAsArray () { // Get reflection from this - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DATA: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DATA: CALLED!'); $reflectionInstance = new ReflectionClass($this); // Get all properties @@ -364,14 +364,14 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera $packageData = array(); // Loop through all - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: properties()=%d', count($properties))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: properties()=%d', count($properties))); foreach ($properties as $propertyInstance) { // Is the declaring class this one? //* DEBUG-DIE: */ die(sprintf('[%s:%d] propertyInstance=%s', __METHOD__, __LINE__, print_r($propertyInstance))); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: propertyInstance->declaringClass->name=%s', $propertyInstance->getDeclaringClass()->getName())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: propertyInstance->declaringClass->name=%s', $propertyInstance->getDeclaringClass()->getName())); if ($propertyInstance->getDeclaringClass()->getName() !== $this->__toString()) { // No, then skip this one - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: propertyInstance->declaringClass->name=%s is not matching - skip!', $propertyInstance->getDeclaringClass()->getName())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: propertyInstance->declaringClass->name=%s is not matching - skip!', $propertyInstance->getDeclaringClass()->getName())); continue; } @@ -379,12 +379,12 @@ class PackageData extends BaseHubSystem implements DeliverablePackage, Registera $value = call_user_func_array(array($this, sprintf('get%s', ucfirst($propertyInstance->getName()))), array()); // Add name/value - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: Adding %s[%s]=%s', $propertyInstance->getName(), gettype($value), $value)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: Adding %s[%s]=%s', $propertyInstance->getName(), gettype($value), $value)); $packageData[$propertyInstance->getName()] = $value; } // Return array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: packageData()=%d - EXIT!', count($packageData))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: packageData()=%d - EXIT!', count($packageData))); return $packageData; } diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index 271c9a804..ff4ebccbc 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -130,7 +130,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public static final function createPackageFragmenter () { // Get new instance - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!'); $fragmenterInstance = new PackageFragmenter(); // Get a crypto instance and set it here @@ -148,7 +148,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function initFragmenter () { // Load some configuration entries and "cache" them: - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!'); // - Chunk size in bits $this->chunkSize = $this->getConfigInstance()->getConfigEntry('package_chunk_size'); @@ -156,7 +156,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $this->maxSerialNumber = $this->hex2dec(str_repeat('f', self::MAX_SERIAL_LENGTH)); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } /** @@ -167,7 +167,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function initPointer ($finalHash) { // Init counter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); $this->chunkPointers[$finalHash] = 0; } @@ -179,7 +179,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function getProcessedPackagesIndex (DeliverablePackage $packageInstance) { // Generate array index - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); return ( $packageInstance->getSenderAddress() . NetworkPackageHandler::PACKAGE_DATA_SEPARATOR . $packageInstance->getRecipientUnl() . NetworkPackageHandler::PACKAGE_DATA_SEPARATOR . @@ -195,7 +195,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function isPackageProcessed (DeliverablePackage $packageInstance) { // Get array index - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); $index = $this->getProcessedPackagesIndex($packageInstance); // Is the array index there? @@ -206,7 +206,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera ); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: isProcessed=%d - EXIT!', intval($isProcessed))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: isProcessed=%d - EXIT!', intval($isProcessed))); return $isProcessed; } @@ -218,7 +218,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function markPackageDataProcessed (DeliverablePackage $packageInstance) { // Remember it (until we may remove it) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); $this->processedPackages[$this->getProcessedPackagesIndex($packageInstance)] = TRUE; } @@ -230,7 +230,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function getFinalHashFromPackageInstance (DeliverablePackage $packageInstance) { // Make sure it is there - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s - CALLED!', $packageInstance->__toString())); assert(isset($this->processedPackages[$this->getProcessedPackagesIndex($packageInstance)])); // Return it @@ -244,14 +244,14 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function getCurrentChunkPointer ($finalHash) { // Is the final hash valid? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); assert(strlen($finalHash) > 0); // Is the pointer already initialized? assert(isset($this->chunkPointers[$finalHash])); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: Returning chunk pointers for finalHash=%s - EXIT!', $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: Returning chunk pointers for finalHash=%s - EXIT!', $finalHash)); return $this->chunkPointers[$finalHash]; } @@ -262,11 +262,11 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function nextChunkPointer ($finalHash) { // Is the pointer already initialized? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); assert(isset($this->chunkPointers[$finalHash])); // Count one up - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s', gettype($finalHash), $finalHash)); $this->chunkPointers[$finalHash]++; } @@ -278,7 +278,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function getDataChunkSizeFromHash ($hash) { // Calculate real (data) chunk size - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: hash=%s - CALLED!', $hash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: hash=%s - CALLED!', $hash)); $dataChunkSize = ( // Real chunk size ($this->chunkSize / 8) - @@ -294,7 +294,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert($dataChunkSize > 0); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: dataChunkSize=%d - CALLED!', $dataChunkSize)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: dataChunkSize=%d - CALLED!', $dataChunkSize)); return $dataChunkSize; } @@ -310,11 +310,11 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera * Get the crypto instance and hash the data with no extra salt because * the other peer doesn't have *this* peer's salt. */ - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData=%s - CALLED!', $rawData)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData=%s - CALLED!', $rawData)); $hash = $this->getCryptoInstance()->hashString($rawData, '', FALSE); // Return it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: hash=%s - EXIT!', $hash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: hash=%s - EXIT!', $hash)); return $hash; } @@ -329,20 +329,20 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function appendEndOfPackageChunk ($lastChunk, $finalHash) { // Generate end-of-package marker - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: lastChunk=%s,finalHash[%s]=%s - CALLED!', $lastChunk, gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: lastChunk=%s,finalHash[%s]=%s - CALLED!', $lastChunk, gettype($finalHash), $finalHash)); $chunkData = self::END_OF_PACKAGE_IDENTIFIER . $finalHash . self::CHUNK_HASH_SEPARATOR . $this->generateHashFromRawData($lastChunk); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Adding EOP chunk with size of ' . strlen($chunkData) . ',finalHash=' . $finalHash . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Adding EOP chunk with size of ' . strlen($chunkData) . ',finalHash=' . $finalHash . ' ...'); // Add it as regular chunk $this->addChunkData($finalHash, $chunkData); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } /** @@ -356,7 +356,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function splitEncodedDataIntoChunks ($rawData, $finalHash) { // Make sure final hashes with at least 32 bytes can pass - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData=%s,finalHash[%s]=%s - CALLED!', $rawData, gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData=%s,finalHash[%s]=%s - CALLED!', $rawData, gettype($finalHash), $finalHash)); assert(strlen($finalHash) >= 32); // Calculate real (data) chunk size @@ -377,13 +377,13 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera } // END - for // Debug output - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Raw data of ' . strlen($rawData) . ' bytes has been fragmented into ' . count($this->chunks[$finalHash]) . ' chunk(s).'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Raw data of ' . strlen($rawData) . ' bytes has been fragmented into ' . count($this->chunks[$finalHash]) . ' chunk(s).'); // Add end-of-package chunk $this->appendEndOfPackageChunk($chunkData, $finalHash); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } /** @@ -397,7 +397,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function addChunkData ($finalHash, $chunkData, $prepend = FALSE) { // Hash it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s,chunkData=%s,prepend=%d - CALLED!', gettype($finalHash), $finalHash, $chunkData, intval($prepend))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s,chunkData=%s,prepend=%d - CALLED!', gettype($finalHash), $finalHash, $chunkData, intval($prepend))); $rawDataHash = $this->getCryptoInstance()->hashString($chunkData, '', FALSE); // Prepend the hash to the chunk @@ -408,7 +408,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera ); // Make sure the chunk is not larger than a TCP package can hold - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: assert: ' . strlen($rawData) . '/' . NetworkPackageHandler::TCP_PACKAGE_SIZE . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: assert: ' . strlen($rawData) . '/' . NetworkPackageHandler::TCP_PACKAGE_SIZE . ' ...'); // @TODO This assert broke packages where the hash chunk was very large: assert(strlen($rawData) <= NetworkPackageHandler::TCP_PACKAGE_SIZE); // Add it to the array @@ -434,7 +434,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera } // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } /** @@ -445,14 +445,14 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ private function prependHashChunk ($finalHash) { // "Implode" the whole array of hashes into one string - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); $rawData = self::HASH_CHUNK_IDENTIFIER . implode(self::CHUNK_HASH_SEPARATOR, $this->chunkHashes[$finalHash]); // Prepend chunk $this->addChunkData($finalHash, $rawData, TRUE); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } /** @@ -463,7 +463,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function getNextHexSerialNumber ($finalHash) { // Assert on maximum serial number length - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); assert(isset($this->serialNumber[$finalHash])); assert($this->serialNumber[$finalHash] <= $this->maxSerialNumber); @@ -475,7 +475,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $this->serialNumber[$finalHash]++; // Return the encoded serial number - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: encodedSerialNumber=' . $encodedSerialNumber . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: encodedSerialNumber=' . $encodedSerialNumber . ' - EXIT!'); return $encodedSerialNumber; } @@ -492,19 +492,19 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function fragmentPackageArray (DeliverablePackage $packageInstance, ConnectionHelper $helperInstance) { // Is this package already fragmented? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s,helperInstance=%s - CALLED!', $packageInstance->__toString(), $helperInstance->__toString())); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: packageInstance=%s,helperInstance=%s - CALLED!', $packageInstance->__toString(), $helperInstance->__toString())); if (!$this->isPackageProcessed($packageInstance)) { // First we need to "implode" the array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Package is not processed., getting all raw data ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Package is not processed., getting all raw data ...'); $rawData = implode(NetworkPackageHandler::PACKAGE_DATA_SEPARATOR, $packageInstance->getAllAsArray()); // Generate the final hash from the raw data (not encoded!) //* DEBUG-DIE: */ die(sprintf('[%s:%d]: rawData[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($rawData), $rawData)); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData(%d)=%s', strlen($rawData), $rawData)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: rawData(%d)=%s', strlen($rawData), $rawData)); $finalHash = $this->generateHashFromRawData($rawData); // Remember it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash=%s', $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash=%s', $finalHash)); $this->processedPackages[$this->getProcessedPackagesIndex($packageInstance)] = $finalHash; // Init pointer and reset serial number @@ -521,13 +521,13 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $this->markPackageDataProcessed($packageInstance); } else { // Get the final hash from the package data - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Package is already processed, getting final hash ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Package is already processed, getting final hash ...'); $finalHash = $this->getFinalHashFromPackageInstance($packageInstance); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash=%s', $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash=%s', $finalHash)); } // Return final hash - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - EXIT!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - EXIT!', gettype($finalHash), $finalHash)); return $finalHash; } @@ -542,7 +542,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function getNextRawDataChunk ($finalHash) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); try { // Get current chunk index @@ -577,7 +577,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $this->nextChunkPointer($finalHash); // Return the chunk array - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Returning rawDataChunk ... - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Returning rawDataChunk ... - EXIT!'); return $rawDataChunk; } @@ -589,14 +589,14 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function resetSerialNumber ($finalHash) { // Final hash must be set - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-FRAGMENTER: finalHash[%s]=%s - CALLED!', gettype($finalHash), $finalHash)); assert((is_string($finalHash)) && (!empty($finalHash))); // Reset/set serial number $this->serialNumber[$finalHash] = 0; // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: EXIT!'); } } diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index d16cfa63c..adec18383 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -369,16 +369,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke * @todo 0% done */ public function isIncomingSocketRegistered () { - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: CALLED!'); - // Default is not found + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: CALLED!'); $isRegistered = FALSE; - // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: isRegistered=%d - EXIT!', intval($isRegistered))); - // Return status + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-REGISTRY: isRegistered=%d - EXIT!', intval($isRegistered))); return $isRegistered; } diff --git a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index 0fea99172..b76df0f76 100644 --- a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -83,7 +83,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List */ public function visitListener (Listenable $listenerInstance) { // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); /* * The TCP/UDP listener have a socket registry instance set. These @@ -92,7 +92,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List $listenerInstance->monitorIncomingRawData(); // Trace message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: EXIT!'); } /** -- 2.39.5