From: Roland Häder Date: Sat, 4 Aug 2012 22:22:55 +0000 (+0000) Subject: Rewrote debug lines (even more), re-enabled debugging lines in socket layer X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d97d0d0a06bab9dd8d141a4a2ecb69564bbb489f;p=hub.git Rewrote debug lines (even more), re-enabled debugging lines in socket layer --- diff --git a/application/hub/main/connectors/query/local/class_LocalQueryConnector.php b/application/hub/main/connectors/query/local/class_LocalQueryConnector.php index a6aa178b4..42121451e 100644 --- a/application/hub/main/connectors/query/local/class_LocalQueryConnector.php +++ b/application/hub/main/connectors/query/local/class_LocalQueryConnector.php @@ -88,7 +88,7 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Vis $currentQuery = $this->getIteratorInstance()->current(); // Only while construction, else it would output to much! - /* DEBUG: */ $this->debugOutput('CONNECTOR: Handling query ' . $currentQuery); + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTOR: Handling query ' . $currentQuery); } /** diff --git a/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php b/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php index 8cb968346..6398afa34 100644 --- a/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php +++ b/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php @@ -68,7 +68,7 @@ class LocalQueueConnector extends BaseQueueConnector implements Connectable, Que $currentQueues = $this->getIteratorInstance()->current(); // Only while construction, else it would output to much! - /* DEBUG: */ $this->debugOutput('CONNECTOR: Handling queue entry ' . $currentQueues); + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTOR: Handling queue entry ' . $currentQueues); } /** diff --git a/application/hub/main/cruncher/mcrypt/class_HubMcryptCruncher.php b/application/hub/main/cruncher/mcrypt/class_HubMcryptCruncher.php index f97eed8a8..9795b87a4 100644 --- a/application/hub/main/cruncher/mcrypt/class_HubMcryptCruncher.php +++ b/application/hub/main/cruncher/mcrypt/class_HubMcryptCruncher.php @@ -119,14 +119,14 @@ class HubMcryptCruncher extends BaseHubCruncher implements CruncherHelper, Regis */ public function outputConsoleTeaser () { // Output all lines - $this->debugOutput(' '); - $this->debugOutput('MCrypt Cruncher v' . $this->getVersion() . ' is starting ...'); - $this->debugOutput('Copyright (c) 2011 Hub Developer Team'); - $this->debugOutput(' '); - $this->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); - $this->debugOutput('This is free software, and you are welcome to redistribute it under certain'); - $this->debugOutput('conditions; see docs/COPYING for details.'); - $this->debugOutput(' '); + self::createDebugInstance(__CLASS__)->debugOutput(' '); + self::createDebugInstance(__CLASS__)->debugOutput('MCrypt Cruncher v' . $this->getVersion() . ' is starting ...'); + self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2011 Hub Developer Team'); + self::createDebugInstance(__CLASS__)->debugOutput(' '); + self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); + self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain'); + self::createDebugInstance(__CLASS__)->debugOutput('conditions; see docs/COPYING for details.'); + self::createDebugInstance(__CLASS__)->debugOutput(' '); } /** diff --git a/application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php b/application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php index 62724df99..9cab290b4 100644 --- a/application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php @@ -102,7 +102,7 @@ class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements NodeListWra $recipient = $recipientIp . ':' . $recipientPort; // Debug message - $this->debugOutput('DATABASE-WRAPPER: sessionId[' . $protocol . ']=' . $sessionId . ' resolved as recipient=' . $recipient); + self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: sessionId[' . $protocol . ']=' . $sessionId . ' resolved as recipient=' . $recipient); } // END - if // Return result diff --git a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php index 4c9f2f499..42366edf9 100644 --- a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php @@ -70,7 +70,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look */ private function getSenderSearchInstanceFromPackageData (array $packageData) { // Get the instance - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: Searching for sender ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: Searching for sender ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER]); $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add 'sender' as the peer's IP address @@ -90,7 +90,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look */ public function isSenderNewPeer (array $packageData, StoreableCriteria $dataSetInstance = NULL) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: ' . __FUNCTION__ . ' called with packageData()=' . count($packageData) . ' - ENTERED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: ' . __FUNCTION__ . ' called with packageData()=' . count($packageData) . ' - ENTERED!'); // Is always new peer by default $isNewPeer = true; @@ -114,11 +114,11 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look $entries = $this->doSelectCountByCriteria($searchInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); // Is it there? - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: entries=' . $entries); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: entries=' . $entries); $isNewPeer = ($entries != 1); // Return the result - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); return $isNewPeer; } @@ -164,7 +164,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered.'); } /** @@ -207,7 +207,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look } // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered/updated with state ' . $stateInstance->getStateName()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered/updated with state ' . $stateInstance->getStateName()); } /** @@ -229,7 +229,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look } // END - if // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: peerName=' . $peerName . ',peerPort=' . $peerPort . ' - UNFINISHED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: peerName=' . $peerName . ',peerPort=' . $peerPort . ' - UNFINISHED!'); } /** @@ -242,7 +242,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look */ public function isSamePeerState (ConnectionHelper $helperInstance, array $packageData) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: State ' . $helperInstance->getPrintableState() . ' needs to be checked it has changed ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: State ' . $helperInstance->getPrintableState() . ' needs to be checked it has changed ...'); // Now get the search instance from given package data $searchInstance = $this->getSenderSearchInstanceFromPackageData($packageData); @@ -260,7 +260,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look $isSamePeerState = ($rowData[self::DB_COLUMN_PEER_STATE] == $helperInstance->getPrintableState()); // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('DATABASE-WRAPPER: state in database: ' . $rowData[self::DB_COLUMN_PEER_STATE] . ', new state: ' . $helperInstance->getPrintableState() . ',isSamePeerState=' . intval($isSamePeerState)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: state in database: ' . $rowData[self::DB_COLUMN_PEER_STATE] . ', new state: ' . $helperInstance->getPrintableState() . ',isSamePeerState=' . intval($isSamePeerState)); // Return it return $isSamePeerState; diff --git a/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php index 6cb238f09..ced9a3450 100644 --- a/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php +++ b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php @@ -61,7 +61,7 @@ class ChatBootstrapGenericActivationFilter extends BaseFilter implements Filtera $chatInstance->enableIsActive(); // Debug message - $this->debugOutput('BOOTSTRAP: The chat console has been activated.'); + self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: The chat console has been activated.'); } } diff --git a/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php b/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php index 5dc84c2b0..2faff3226 100644 --- a/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php +++ b/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrapGenericActivationFilter.php @@ -61,7 +61,7 @@ class CruncherBootstrapGenericActivationFilter extends BaseFilter implements Fil $cruncherInstance->enableIsActive(); // Debug message - $this->debugOutput('BOOTSTRAP: The cruncher has been activated.'); + self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: The cruncher has been activated.'); } } diff --git a/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php b/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php index 17451fc51..1f537d0cb 100644 --- a/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php +++ b/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php @@ -92,7 +92,7 @@ class PackageAnnouncementAnswerTagFilter extends BaseFilter implements Filterabl */ public function processMessage ($messageContent, Receivable $packageInstance) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-ANSWER-TAG: messageContent(' . strlen($messageContent) . ')=' . $messageContent); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-ANSWER-TAG: messageContent(' . strlen($messageContent) . ')=' . $messageContent); // Get a template instance from the factory $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_answer_template_class'); @@ -116,14 +116,14 @@ class PackageAnnouncementAnswerTagFilter extends BaseFilter implements Filterabl */ if (is_null($value)) { // Output a warning - $this->debugOutput('ANNOUNCEMENT-ANSWER-TAG: Found not fully supported variable ' . $key . ' - skipping.'); + self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-ANSWER-TAG: Found not fully supported variable ' . $key . ' - skipping.'); // Skip this part, don't write NULLs to the array continue; } // END - if // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-ANSWER-TAG: key=' . $key . ',value=' . $value); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-ANSWER-TAG: key=' . $key . ',value=' . $value); // Set it now $this->dataXmlNodes[$key] = $value; diff --git a/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php b/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php index 6d567a21f..cefe09168 100644 --- a/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php @@ -136,12 +136,12 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, true)); // "Walk" throught the translation array foreach ($this->messageToConfig as $messageKey => $configKey) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); // Set the element in configuration $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]); @@ -150,7 +150,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl // "Walk" throught the config-copy array foreach ($this->configCopy as $targetKey => $sourceKey) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); // Copy from source to targetKey $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); diff --git a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index 91e3ecb03..f537b8ed0 100644 --- a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -59,7 +59,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle // Are node id and session id the same? if (($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_NODE_ID] == $this->getNodeId()) && ($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_SESSION_ID] == $this->getSessionId())) { // Both are equal - $this->debugOutput('SELF-CONNECT: Have connected to myself, both node and session id are equal!'); + self::createDebugInstance(__CLASS__)->debugOutput('SELF-CONNECT: Have connected to myself, both node and session id are equal!'); // Get node instance ... $nodeInstance = Registry::getRegistry()->getInstance('node'); diff --git a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php index f3ecf6105..5caca8bed 100644 --- a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php +++ b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php @@ -69,7 +69,7 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $decodedData = false; // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('TCP-HANDLER: Handling TCP package from resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $socketArray[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER: Handling TCP package from resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $socketArray[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]))); /* * Read the raw data from socket. If you change PHP_BINARY_READ to @@ -79,12 +79,12 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $rawData = socket_read($socketArray[BasePool::SOCKET_ARRAY_RESOURCE], $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ); // Debug output of read data length - //* NOISY-DEBUG: */ $this->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',error=' . socket_strerror(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',error=' . socket_strerror(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]))); // Is it valid? if (socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]) == 11) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE]); /* * Error code 11 (Resource temporary unavailable) can be safely diff --git a/application/hub/main/helper/connection/class_BaseConnectionHelper.php b/application/hub/main/helper/connection/class_BaseConnectionHelper.php index e0a1e2e0c..2c4086193 100644 --- a/application/hub/main/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/main/helper/connection/class_BaseConnectionHelper.php @@ -420,7 +420,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc // Deliver all data while ($sentBytes !== false) { // And deliver it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: Sending out ' . strlen($encodedData) . ' bytes,bufferSize=' . $bufferSize . ',diff=' . $this->diff); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: Sending out ' . strlen($encodedData) . ' bytes,bufferSize=' . $bufferSize . ',diff=' . $this->diff); if ($this->diff >= 0) { // Send all out (encodedData is smaller than or equal buffer size) $sentBytes = socket_write($socketResource, $encodedData, ($bufferSize - $this->diff)); @@ -438,7 +438,7 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc throw new InvalidSocketException(array($this, $socketResource, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET); } elseif (($sentBytes == 0) && (strlen($encodedData) > 0)) { // Nothing sent means we are done - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); break; } @@ -458,13 +458,13 @@ class BaseConnectionHelper extends BaseHubHelper implements Registerable, Protoc // Can we abort? if (strlen($encodedData) <= 0) { // Abort here, all sent! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); break; } // END - if } // END - while // Return sent bytes - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: totalSentBytes=' . $totalSentBytes . ',diff=' . $this->diff); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER: totalSentBytes=' . $totalSentBytes . ',diff=' . $this->diff); return $totalSentBytes; } diff --git a/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php b/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php index e515c284b..262319564 100644 --- a/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php +++ b/application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php @@ -140,7 +140,7 @@ class TcpConnectionHelper extends BaseConnectionHelper implements ConnectionHelp */ public function doShutdown () { // Debug message - $this->debugOutput('HELPER: Shutting down socket resource ' . $this->getSocketResource()); + self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Shutting down socket resource ' . $this->getSocketResource()); // Clear any previous errors socket_clear_error($this->getSocketResource()); diff --git a/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php b/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php index 31ba443c7..722a5f43e 100644 --- a/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php +++ b/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php @@ -61,7 +61,7 @@ class HubAnnouncementHelper extends BaseHubHelper implements HelpableHub { */ public function loadDescriptorXml () { // Debug message - $this->debugOutput('HELPER: Starting with announcement to upper hubs...'); + self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Starting with announcement to upper hubs...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class'); diff --git a/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php b/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php index 2922dd74b..67f7f40b1 100644 --- a/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php +++ b/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php @@ -63,7 +63,7 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements */ public function loadDescriptorXml () { // Debug message - $this->debugOutput('HELPER: Attempting to answer an announcement...'); + self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer an announcement...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_answer_template_class'); diff --git a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php index bbffca3b7..e0dd2fe43 100644 --- a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php +++ b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php @@ -61,7 +61,7 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub { */ public function loadDescriptorXml () { // Debug message - $this->debugOutput('HELPER: Attempting self-connect...'); + self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting self-connect...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class'); diff --git a/application/hub/main/iterator/producer/keys/class_TestUnitKeyProducerIterator.php b/application/hub/main/iterator/producer/keys/class_TestUnitKeyProducerIterator.php index 2eebb2e54..75b057c3d 100644 --- a/application/hub/main/iterator/producer/keys/class_TestUnitKeyProducerIterator.php +++ b/application/hub/main/iterator/producer/keys/class_TestUnitKeyProducerIterator.php @@ -56,7 +56,7 @@ class TestUnitKeyProducerIterator extends BaseIterator implements Iterator { $this->maxBits = pow(2, $this->keyLength); // Debug message - $this->debugOutput('ITERATOR: maxBits=' . $this->maxBits . ',keyLength=' . $this->keyLength . ' bits'); + self::createDebugInstance(__CLASS__)->debugOutput('ITERATOR: maxBits=' . $this->maxBits . ',keyLength=' . $this->keyLength . ' bits'); } /** diff --git a/application/hub/main/package/assembler/class_PackageAssembler.php b/application/hub/main/package/assembler/class_PackageAssembler.php index 26e431243..c41ef71e7 100644 --- a/application/hub/main/package/assembler/class_PackageAssembler.php +++ b/application/hub/main/package/assembler/class_PackageAssembler.php @@ -65,7 +65,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable $isInputBufferEmpty = $this->getPackageInstance()->getStackerInstance()->isStackEmpty(NetworkPackage::STACKER_NAME_DECODED_HANDLED); // Debug message - //* NOISY-DEBUG: */ $this->debugOutput('PACKAGE-ASSEMBLER: isInputBufferEmpty=' . intval($isInputBufferEmpty)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: isInputBufferEmpty=' . intval($isInputBufferEmpty)); // Return it return $isInputBufferEmpty; @@ -121,7 +121,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable */ private function handlePackageByUnhandledPackage (array $packageContent) { // Debug message - /* NOISY-DEBUG: */ $this->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_DECODED_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_DECODED_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]); // Check for some conditions if (!$this->ifInputBufferIsEmpty()) { @@ -129,10 +129,10 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_DECODED_DATA]; // Debug message - /* NOISY-DEBUG: */ $this->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_DECODED_DATA]) . ' bytes)'); } else { // Debug message - //* NOISY-DEBUG */ $this->debugOutput('packageContent=' . print_r($packageContent,true) . ',chunks='.print_r($chunks,true)); + //* 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 @@ -182,7 +182,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable $this->pendingData = ''; // Debug message - /* NOISY-DEBUG: */ $this->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_DECODED_DATA]) . ' bytes has been received.'); // Call the real handler method $this->handlePackageByUnhandledPackage($packageContent); diff --git a/application/hub/main/package/fragmenter/class_PackageFragmenter.php b/application/hub/main/package/fragmenter/class_PackageFragmenter.php index 1f3adba57..e390e92a2 100644 --- a/application/hub/main/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/main/package/fragmenter/class_PackageFragmenter.php @@ -220,7 +220,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert(strlen($finalHash) > 0); // Is the pointer already initialized? - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); assert(isset($this->chunkPointers[$finalHash])); // Return it @@ -237,7 +237,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert(isset($this->chunkPointers[$finalHash])); // Count one up - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); $this->chunkPointers[$finalHash]++; } @@ -302,7 +302,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $this->generateHashFromRawData($lastChunk); // Debug message - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': Adding EOP chunk with size of ' . strlen($chunkData) . ',finalHash=' . $finalHash . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': Adding EOP chunk with size of ' . strlen($chunkData) . ',finalHash=' . $finalHash . ' ...'); // Add it as regular chunk $this->addChunkData($finalHash, $chunkData); @@ -323,7 +323,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Calculate real (data) chunk size $dataChunkSize = $this->getDataChunkSizeFromHash($finalHash); - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': dataChunkSize=' . $dataChunkSize); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': dataChunkSize=' . $dataChunkSize); // Init variables $chunkHash = ''; @@ -339,7 +339,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera } // END - for // Debug output - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': Raw data of ' . strlen($rawData) . ' bytes has been fragmented into ' . count($this->chunks[$finalHash]) . ' chunk(s).'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': 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); @@ -371,12 +371,12 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Add it to the array if ($prepend === true) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': Prepending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': Prepending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); array_unshift($this->chunkHashes[$finalHash], $rawDataHash); array_unshift($this->chunks[$finalHash] , $rawData); } else { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': Appending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': Appending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); $this->chunks[$finalHash][] = $rawData; $this->chunkHashes[$finalHash][] = $rawDataHash; } @@ -459,7 +459,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera } // Return final hash - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); return $finalHash; } @@ -474,7 +474,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function getNextRawDataChunk ($finalHash) { // Debug message - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': finalHash[' . gettype($finalHash) . ']=' . $finalHash); try { // Get current chunk index @@ -493,12 +493,12 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // If there is no entry left, return an empty array if ((!isset($this->chunkHashes[$finalHash][$current])) || (!isset($this->chunks[$finalHash][$current]))) { // No more entries found - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ' - No more entries found!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ' - No more entries found!'); return array(); } // END - if // Debug message - //* NOISY-DEBUG: */ $this->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ',chunkHashes()=' . count($this->chunkHashes[$finalHash]) .' - Entry choosen ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ',chunkHashes()=' . count($this->chunkHashes[$finalHash]) .' - Entry choosen ...'); // Generate the array $rawDataChunk = array( @@ -519,7 +519,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function resetSerialNumber () { // Debug message - /* NOISY-DEBUG: */ $this->debugOutput('FRAGMENTER: Resetting serial number, previous=' . $this->serialNumber); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('FRAGMENTER: Resetting serial number, previous=' . $this->serialNumber); // Reset serial number $this->serialNumber = 0; diff --git a/application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php b/application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php index 37f6102f4..9242d0f0b 100644 --- a/application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php +++ b/application/hub/main/producer/cruncher/keys/class_CruncherKeyProducer.php @@ -75,11 +75,11 @@ class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Regist // Is this cruncher virgin? if (!$stateInstance->isCruncherStateVirgin()) { // This cruncher is not virgin, so skip it - $this->debugOutput('PRODUCER: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . ''); + self::createDebugInstance(__CLASS__)->debugOutput('PRODUCER: The cruncher is not virgin. stateInstance=' . $stateInstance->__toString() . ''); return; } elseif (!$this->getIteratorInstance()->valid()) { // This producer's iterator has finished its assignment - $this->debugOutput('PRODUCER: Finished creating keys. iteratorinstance=' . $this->getIteratorInstance()->__toString() . ''); + self::createDebugInstance(__CLASS__)->debugOutput('PRODUCER: Finished creating keys. iteratorinstance=' . $this->getIteratorInstance()->__toString() . ''); return; } @@ -104,7 +104,7 @@ class CruncherKeyProducer extends BaseKeyProducer implements KeyProducer, Regist // Is the per-work unit limit reached? if ($this->isOutgoingQueueLimitReached('cruncher_per_unit_key_limit')) { // @TODO Do something with it - $this->debugOutput('currentKey(b64)="' . base64_encode($currentKey) . '" needs to be processed.'); + self::createDebugInstance(__CLASS__)->debugOutput('currentKey(b64)="' . base64_encode($currentKey) . '" needs to be processed.'); // At last re-init the stack $this->initOutgoingQueue(); diff --git a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php index b0ca550af..6629b708a 100644 --- a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php @@ -106,7 +106,7 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer, $encryptedMessage = $this->getHelperInstance()->generateRandomMessage(); // Debug message - $this->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...'); + self::createDebugInstance(__CLASS__)->debugOutput('PRODUCER: An encrypted, random message has been generated. Generating keys ...'); // Set the encrypted message in the template instance $this->getTemplateInstance()->assignVariable('encrypted_message', $encryptedMessage); diff --git a/application/hub/main/tags/package/class_PackageTags.php b/application/hub/main/tags/package/class_PackageTags.php index e893f3126..8b2ea3501 100644 --- a/application/hub/main/tags/package/class_PackageTags.php +++ b/application/hub/main/tags/package/class_PackageTags.php @@ -69,7 +69,7 @@ class PackageTags extends BaseTags implements Tagable { */ private function initObjectRegistry () { // Output debug message - $this->debugOutput('TAGS: Initializing object registry - START'); + self::createDebugInstance(__CLASS__)->debugOutput('TAGS: Initializing object registry - START'); // Get the application instance $applicationInstance = Registry::getRegistry()->getInstance('app'); @@ -87,7 +87,7 @@ class PackageTags extends BaseTags implements Tagable { $this->getTemplateInstance()->renderXmlContent(); // Output debug message - $this->debugOutput('TAGS: Initializing object registry - FINISHED'); + self::createDebugInstance(__CLASS__)->debugOutput('TAGS: Initializing object registry - FINISHED'); } /** @@ -123,7 +123,7 @@ class PackageTags extends BaseTags implements Tagable { // "Walk" over all tags foreach ($this->getTags() as $tag) { // Debug output - $this->debugOutput('TAGS: Validating tag ' . $tag . ' ...'); + self::createDebugInstance(__CLASS__)->debugOutput('TAGS: Validating tag ' . $tag . ' ...'); // Get an array from this tag $entry = $objectRegistryInstance->getArrayFromKey($tag); diff --git a/application/hub/main/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/main/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index e110d064c..b6c6a25c6 100644 --- a/application/hub/main/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/main/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -84,9 +84,9 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List */ public function visitDecorator (BaseDecorator $decoratorInstance) { // Do monitor here - //* NOISY-DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - START'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - START'); $decoratorInstance->monitorIncomingRawData($this->getReceiverInstance()); - //* NOISY-DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - FINISH'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - FINISH'); } } diff --git a/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php b/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php index 45262dd70..faaf1dbee 100644 --- a/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php +++ b/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php @@ -56,13 +56,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitPool (Poolable $poolInstance) { // Debug message - $this->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - START'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - START'); // Pre-shutdown the pool $poolInstance->preShutdown(); // Debug message - $this->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - FINISHED'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - FINISHED'); } /** @@ -73,13 +73,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitDecorator (Listenable $decoratorInstance) { // Debug message - $this->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - START'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - START'); // Pre-shutdown the pool $decoratorInstance->doShutdown(); // Debug message - $this->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - FINISHED'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - FINISHED'); } /** @@ -90,13 +90,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitListener (Listenable $listenerInstance) { // Debug message - $this->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - START'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - START'); // Pre-shutdown the pool $listenerInstance->doShutdown(); // Debug message - $this->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - FINISHED'); + self::createDebugInstance(__CLASS__)->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - FINISHED'); } }