From b55aa93db5ba571cbf0db9ee4cff28e6dd6dfd71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 30 May 2017 14:00:52 +0200 Subject: [PATCH] Continued: - enabled all(?) debug messages - use StorableSocket::SOCKET_PROTOCOL_FOO instead of 'foo' which is more flexible - added more debug messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../classes/client/http/class_HttpClient.php | 2 +- .../socket/class_SocketContainer.php | 14 ++- ...odeDistributedHashTableDatabaseWrapper.php | 72 ++++++------ .../class_PeerStateLookupDatabaseWrapper.php | 18 +-- .../decoder/package/class_PackageDecoder.php | 8 +- application/hub/classes/dht/class_BaseDht.php | 10 +- .../classes/dht/node/class_NodeDhtFacade.php | 12 +- .../class_UniversalNodeLocatorDiscovery.php | 4 +- .../socket/class_PackageSocketDiscovery.php | 24 ++-- .../class_UniversalNodeLocatorFactory.php | 3 + .../factories/socket/class_SocketFactory.php | 28 ++++- .../states/peer/class_PeerStateFactory.php | 16 ++- .../class_HubcoinRewardFeature.php | 16 ++- .../classes/filter/class_BaseHubFilter.php | 4 +- .../node/class_NodeInitializationFilter.php | 4 +- .../handler/chunks/class_ChunkHandler.php | 32 ++--- .../class_NodeMessageAnnouncementHandler.php | 10 +- ...odeMessageRequestNodeListAnswerHandler.php | 8 +- .../class_NodeMessageDhtBootstrapHandler.php | 10 +- ...lass_NodeMessageRequestNodeListHandler.php | 8 +- .../protocol/class_BaseProtocolHandler.php | 8 +- .../ipv4/class_BaseIpV4ProtocolHandler.php | 6 +- .../raw_data/tcp/class_TcpRawDataHandler.php | 10 +- .../connection/class_BaseConnectionHelper.php | 58 ++++++++-- .../ipv4/class_BaseIpV4ConnectionHelper.php | 2 +- .../helper/dht/class_DhtBootstrapHelper.php | 4 +- .../info/connection/class_ConnectionInfo.php | 8 +- .../classes/listener/class_BaseListener.php | 6 +- .../listener/class_BaseListenerDecorator.php | 11 +- .../class_SocketFileListenerDecorator.php | 3 +- .../class_ClientTcpListenerDecorator.php | 3 +- .../class_HubTcpListenerDecorator.php | 3 +- .../class_ClientUdpListenerDecorator.php | 3 +- .../class_HubUdpListenerDecorator.php | 3 +- .../locator/class_UniversalNodeLocator.php | 11 +- .../classes/nodes/boot/class_HubBootNode.php | 6 +- .../hub/classes/nodes/class_BaseHubNode.php | 12 +- .../assembler/class_PackageAssembler.php | 22 ++-- .../classes/package/class_NetworkPackage.php | 109 +++++++++++------- .../fragmenter/class_PackageFragmenter.php | 28 ++--- .../hub/classes/pools/class_BasePool.php | 10 +- .../listener/class_DefaultListenerPool.php | 6 +- .../pools/peer/class_DefaultPeerPool.php | 8 +- application/hub/classes/recipient/class_ | 2 +- .../recipient/dht/class_DhtRecipient.php | 6 +- .../direct/class_DirectRecipient.php | 2 +- .../recipient/self/class_SelfRecipient.php | 2 +- .../recipient/upper/class_UpperRecipient.php | 2 +- .../registry/socket/class_SocketRegistry.php | 42 +++---- .../classes/source/class_BaseUrlSource.php | 8 +- .../class_CrawlerUploadedListUrlSource.php | 40 +++---- .../states/communicator/class_Communicator | 6 +- .../hub/classes/states/crawler/class_Crawler | 6 +- .../classes/states/cruncher/class_Cruncher | 6 +- .../dht/active/class_DhtActiveState.php | 2 +- .../dht/booting/class_DhtBootingState.php | 2 +- application/hub/classes/states/dht/class_Dht | 2 +- .../states/dht/init/class_DhtInitState.php | 2 +- .../dht/virgin/class_DhtVirginState.php | 2 +- .../miner/booting/class_MinerBootingState.php | 6 +- .../hub/classes/states/miner/class_Miner | 6 +- .../hub/classes/states/node/class_Node | 6 +- .../class_ConnectionStatisticsHelper.php | 10 +- .../input/class_RawDataInputStream.php | 8 +- .../output/class_RawDataOutputStream.php | 8 +- .../tags/package/class_PackageTags.php | 2 +- .../hub/classes/tasks/apt-proxy/class_ | 6 +- .../apt-proxy/class_AptProxyListenerTask.php | 6 +- application/hub/classes/tasks/chat/class_ | 6 +- .../chat/class_ChatTelnetListenerTask.php | 6 +- .../hub/classes/tasks/crawler/class_Crawler | 6 +- .../class_CrawlerNodeCommunicatorTask.php | 4 +- .../class_CrawlerDocumentParserTask.php | 6 +- .../class_CrawlerMimeSnifferTask.php | 6 +- .../crawler/ping/class_CrawlerPingTask.php | 6 +- .../class_CrawlerRemoteJobPublisherTask.php | 6 +- .../tasks/crawler/scanner/class_Crawler | 6 +- .../class_CrawlerUploadedListScannerTask.php | 6 +- .../class_CrawlerSnippetExtractorTask.php | 6 +- .../class_CrawlerStructureAnalyzerTask.php | 6 +- .../class_CrawlerLocalUrlCrawlerTask.php | 6 +- .../class_CrawlerRemoteUrlCrawlerTask.php | 6 +- .../crawler/url_source/class_CrawlerUrlSource | 6 +- .../class_CrawlerUrlSourceFoundRssTask.php | 6 +- .../class_CrawlerUrlSourceLocalStartTask.php | 6 +- .../class_CrawlerUrlSourceRssStartTask.php | 6 +- ...class_CrawlerUrlSourceUploadedListTask.php | 6 +- .../hub/classes/tasks/cruncher/class_Cruncher | 6 +- .../class_CruncherKeyProducerTask.php | 8 +- .../class_CruncherTestUnitProducerTask.php | 8 +- .../class_CruncherWorkUnitFetcherTask.php | 6 +- .../class_MinerBlockFetcherTask.php | 6 +- ...lass_MinerRealGenesisBlockProducerTask.php | 8 +- ...lass_MinerTestGenesisBlockProducerTask.php | 8 +- .../hub/classes/tasks/miner/class_Miner | 6 +- .../class_MinerNodeCommunicatorTask.php | 4 +- .../tasks/network/class_NetworkPackage | 6 +- .../class_NetworkPackageReaderTask.php | 36 +++++- .../class_NetworkPackageWriterTask.php | 26 ++++- .../class_NodeAnnouncementTask.php | 6 +- .../chunks/class_NodeChunkAssemblerTask.php | 6 +- application/hub/classes/tasks/node/class_Node | 6 +- .../decoder/class_NodePackageDecoderTask.php | 6 +- .../hub/classes/tasks/node/dht/class_NodeDht | 6 +- .../node/dht/class_NodeDhtBootstrapTask.php | 2 +- .../dht/class_NodeDhtInitializationTask.php | 2 +- .../dht/class_NodeDhtLateBootstrapTask.php | 2 +- .../dht/class_NodeDhtPublicationCheckTask.php | 2 +- .../node/dht/class_NodeDhtPublicationTask.php | 2 +- .../tasks/node/dht/class_NodeDhtQueryTask.php | 2 +- .../listener/class_NodeSocketListenerTask.php | 8 +- .../tasks/node/ping/class_NodePingTask.php | 6 +- .../class_NodeSelfConnectTask.php | 6 +- .../tags/class_NodePackageTagsInitTask.php | 6 +- .../node/update/class_NodeUpdateCheckTask.php | 6 +- .../hub/classes/tools/class_HubTools.php | 18 +-- .../class_RawDataPoolMonitorVisitor.php | 12 +- .../class_ShutdownListenerPoolVisitor.php | 12 +- .../visitor/tasks/class_ActiveTaskVisitor.php | 8 +- application/hub/config.php | 2 +- core | 2 +- 121 files changed, 622 insertions(+), 579 deletions(-) diff --git a/application/hub/classes/client/http/class_HttpClient.php b/application/hub/classes/client/http/class_HttpClient.php index d3327c420..44ce083b7 100644 --- a/application/hub/classes/client/http/class_HttpClient.php +++ b/application/hub/classes/client/http/class_HttpClient.php @@ -117,7 +117,7 @@ class HttpClient extends BaseClient implements Client { // Add last new-line $rawRequest .= self::HTTP_EOL; - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HTTP-CLIENT: rawRequest=' . $rawRequest); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HTTP-CLIENT: rawRequest=' . $rawRequest); // Write request fwrite($this->getSocketInstance(), $rawRequest); diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index f90e3e432..b458fd0d8 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -138,7 +138,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita $packageData = $this->getPackageData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: unl=' . $unl . ',packageData=' . print_r($packageData, true)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: unl=' . $unl . ',packageData=' . print_r($packageData, true)); // So, does both match? $matches = ((isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) && ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] === $unl)); @@ -607,9 +607,15 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita // Get recipient UNL $unlRecipient = $this->getSocketRecipient(); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: unlRecipient=%s', strtoupper($this->getSocketProtocol()), $unlRecipient)); + // Create UNL instance from it. This will validate the connection $unlInstance = UniversalNodeLocatorFactory::createUnlInstanceFromString($unlRecipient); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: unlAddress=%s,unlPort=%d', strtoupper($this->getSocketProtocol()), $unlInstance->getUnlAddress(), $unlInstance->getUnlPort())); + // Try to connect to it $result = socket_connect($this->getSocketResource(), $unlInstance->getUnlAddress(), $unlInstance->getUnlPort()); @@ -732,7 +738,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); // Do we have changed peers? if (!in_array($this->getSocketResource(), $readers)) { @@ -750,7 +756,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita $socketResource = socket_accept($this->getSocketResource()); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketResource=' . $socketResource . ',serverSocket=' .$this->getSocketResource()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketResource=' . $socketResource . ',serverSocket=' .$this->getSocketResource()); // Create socket instance from it $socketInstance = SocketFactory::createIncomingSocketInstance($socketResource, $this->getSocketProtocol()); @@ -933,7 +939,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita } // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Sending out %d bytes,rawBufferSize=%d,diff=%d', strtoupper($this->getSocketProtocol()), strlen($socketBuffer[NetworkPackage::RAW_INDEX_ENCODED_DATA]), $socketBuffer[NetworkPackage::RAW_INDEX_BUFFER_SIZE], $socketBuffer[NetworkPackage::RAW_INDEX_DIFF])); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Sending out %d bytes,rawBufferSize=%d,diff=%d to socketResource=%s', strtoupper($this->getSocketProtocol()), strlen($socketBuffer[NetworkPackage::RAW_INDEX_ENCODED_DATA]), $socketBuffer[NetworkPackage::RAW_INDEX_BUFFER_SIZE], $socketBuffer[NetworkPackage::RAW_INDEX_DIFF], $this->getSocketResource())); // Is some data still pending or sent all out? if ($socketBuffer[NetworkPackage::RAW_INDEX_DIFF] >= 0) { diff --git a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php index a4a8ce8d7..b92b6f2bf 100644 --- a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -122,7 +122,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ private function prepareSearchInstance (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on array elements assert(isset($nodeData[self::DB_COLUMN_NODE_ID])); @@ -135,7 +135,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $searchInstance->setLimit(1); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $searchInstance; @@ -159,7 +159,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ private function prepareLocalDataSetInstance () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get node/request instances $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -197,7 +197,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $dataSetInstance->addCriteria(self::DB_COLUMN_ACCEPT_BOOTSTRAP, $this->translateBooleanToYesNo($nodeInstance->isAcceptingDhtBootstrap())); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $dataSetInstance; @@ -211,7 +211,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function isLocalNodeRegistered () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get a search criteria instance $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -240,7 +240,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $isRegistered = $resultInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return result return $isRegistered; @@ -253,7 +253,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function registerLocalNode () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert to make sure this method is called with no record in DB (the actual backend of the DHT) assert(!$this->isLocalNodeRegistered()); @@ -265,7 +265,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryInsertDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -276,7 +276,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function updateLocalNode () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert to make sure this method is called with one record in DB (the actual backend of the DHT) assert($this->isLocalNodeRegistered()); @@ -301,7 +301,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -312,7 +312,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function findNodeLocalBySessionId ($sessionId) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: sessionId=' . $sessionId . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: sessionId=' . $sessionId . ' - CALLED!'); // Get search criteria $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -325,7 +325,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: resultInstance->valid()=' . intval($resultInstance->valid()) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: resultInstance->valid()=' . intval($resultInstance->valid()) . ' - EXIT!'); // Return result instance return $resultInstance; @@ -340,7 +340,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: handlerInstance=' . $handlerInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: handlerInstance=' . $handlerInstance->__toString() . ' - CALLED!'); // Get a data set instance $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_DHT)); @@ -358,7 +358,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryInsertDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER - EXIT!'); } /** @@ -371,7 +371,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get a data set instance $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_DHT)); @@ -392,7 +392,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -403,13 +403,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function isNodeRegistered (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on array elements assert(isset($nodeData[self::DB_COLUMN_NODE_ID])); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: node-id=' . $nodeData[self::DB_COLUMN_NODE_ID]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: node-id=' . $nodeData[self::DB_COLUMN_NODE_ID]); // Get search criteria $searchInstance = $this->prepareSearchInstance($nodeData); @@ -429,7 +429,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $isRegistered = $resultInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return registration status return $isRegistered; @@ -445,7 +445,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function registerNode (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on array elements assert(isset($nodeData[self::DB_COLUMN_NODE_ID])); @@ -460,7 +460,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->partialStub('nodeData=' . print_r($nodeData, TRUE)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -474,13 +474,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function updateNode (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on array elements assert(isset($nodeData[self::DB_COLUMN_NODE_ID])); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: Updating DHT entry for node-id=' . $nodeData[self::DB_COLUMN_NODE_ID] . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: Updating DHT entry for node-id=' . $nodeData[self::DB_COLUMN_NODE_ID] . ' ...'); // Is the node registered? if (!$this->isNodeRegistered($nodeData)) { @@ -504,7 +504,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $nodeInstance = NodeObjectFactory::createNodeInstance(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: nodeData=' . print_r($nodeData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: nodeData=' . print_r($nodeData, TRUE)); // Add all array elements $nodeInstance->addArrayToDataSet($dataSetInstance, $nodeData); @@ -516,7 +516,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -542,7 +542,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $hasUnpublished = $this->unpublishedEntriesInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $hasUnpublished; @@ -558,7 +558,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function initEntryPublication () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); /* * Make sure that hasUnpublishedEntries() has been called first by @@ -590,7 +590,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -601,9 +601,9 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function removeNonPublicDataFromArray(array $data) { // Currently call only inner method - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: Calling parent::removeNonPublicDataFromArray(data) ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: Calling parent::removeNonPublicDataFromArray(data) ...'); $data = parent::removeNonPublicDataFromArray($data); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: data[]=' . gettype($data)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: data[]=' . gettype($data)); // Return cleaned data return $data; @@ -617,7 +617,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function getResultFromExcludedSender (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on required array field assert(isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER])); @@ -638,7 +638,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return result instance return $resultInstance; @@ -654,7 +654,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp */ public function getResultFromKeyValue ($key, $value) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get max recipients $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients'); @@ -669,7 +669,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return result instance return $resultInstance; @@ -693,7 +693,5 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp $this->registerLocalNode(); } } -} -// [EOF] -?> +} diff --git a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php index 00db969f7..07a9a5000 100644 --- a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php @@ -88,7 +88,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L */ private function getSenderSearchInstanceFromPackageData (array $packageData) { // Get the instance - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: Searching for sender ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->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 @@ -108,7 +108,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L */ public function isSenderNewPeer (array $packageData, StoreableCriteria $dataSetInstance = NULL) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: ' . __FUNCTION__ . ' called with packageData()=' . count($packageData) . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: ' . __FUNCTION__ . ' called with packageData()=' . count($packageData) . ' - CALLED!'); // Is the package valid? if (!isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER])) { @@ -129,11 +129,11 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $entries = $this->doSelectCountByCriteria($searchInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Is it there? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: entries=' . $entries); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: entries=' . $entries); $isNewPeer = ($entries != 1); // Return the result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: isNewPeer=' . intval($isNewPeer) . ' - EXIT!'); return $isNewPeer; } @@ -183,7 +183,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered.'); } /** @@ -226,7 +226,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered/updated with state ' . $stateInstance->getStateName()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered/updated with state ' . $stateInstance->getStateName()); } /** @@ -250,7 +250,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L */ public function isSamePeerState (ConnectionHelper $helperInstance, array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: State ' . $helperInstance->getPrintableState() . ' needs to be checked it has changed ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->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); @@ -265,7 +265,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $rowData = $resultInstance->current(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: rowData[' . gettype($rowData) . ']=' . print_r($rowData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: rowData[' . gettype($rowData) . ']=' . print_r($rowData, TRUE)); // Assert on important elements assert(isset($rowData[self::DB_COLUMN_PEER_STATE])); @@ -274,7 +274,7 @@ class PeerStateLookupDatabaseWrapper extends BaseHubDatabaseWrapper implements L $isSamePeerState = ($rowData[self::DB_COLUMN_PEER_STATE] == $helperInstance->getPrintableState()); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DATABASE-WRAPPER: state in database: ' . $rowData[self::DB_COLUMN_PEER_STATE] . ', new state: ' . $helperInstance->getPrintableState() . ',isSamePeerState=' . intval($isSamePeerState)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->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/classes/decoder/package/class_PackageDecoder.php b/application/hub/classes/decoder/package/class_PackageDecoder.php index 5cce8c2a8..69004a39d 100644 --- a/application/hub/classes/decoder/package/class_PackageDecoder.php +++ b/application/hub/classes/decoder/package/class_PackageDecoder.php @@ -88,7 +88,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable { $unhandledDataLeft = (!$this->getHandlerInstance()->getStackInstance()->isStackEmpty(ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA)); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: unhandledDataLeft=' . intval($unhandledDataLeft)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: unhandledDataLeft=' . intval($unhandledDataLeft)); return $unhandledDataLeft; } @@ -105,7 +105,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable { $rawPackageContent = $this->getHandlerInstance()->getStackInstance()->popNamed(ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: Got ' . strlen($rawPackageContent) . ' bytes from stack ' . ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA . ', decoding it ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: Got ' . strlen($rawPackageContent) . ' bytes from stack ' . ChunkHandler::STACKER_NAME_ASSEMBLED_RAW_DATA . ', decoding it ...'); // "Decode" the raw package content by using the NetworkPackage instance $decodedData = $this->getPackageInstance()->decodeRawContent($rawPackageContent); @@ -131,7 +131,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable { // Check for 'recipient' field (the 'sender' field and others are ignored here) if ($discoveryInstance->isRecipientListEmpty()) { // The recipient is this node so next stack it on 'decoded_package' - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: Pushing ' . strlen($decodedData) . ' bytes to stack ' . self::STACKER_NAME_DECODED_PACKAGE . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: Pushing ' . strlen($decodedData) . ' bytes to stack ' . self::STACKER_NAME_DECODED_PACKAGE . ' ...'); $this->getHandlerInstance()->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_PACKAGE, $decodedData); } else { // Forward the package to the next node @@ -165,7 +165,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable { $decodedData = $this->getHandlerInstance()->getStackInstance()->popNamed(self::STACKER_NAME_DECODED_PACKAGE); // Handle it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); $this->getPackageInstance()->handleRawData($decodedData); } diff --git a/application/hub/classes/dht/class_BaseDht.php b/application/hub/classes/dht/class_BaseDht.php index afa2061be..6a44c90e1 100644 --- a/application/hub/classes/dht/class_BaseDht.php +++ b/application/hub/classes/dht/class_BaseDht.php @@ -173,7 +173,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { assert(is_array($current)); // ... and push it to the next stack - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT Pushing entry with ' . count($current) . ' elements to stack ' . self::STACKER_NAME_PENDING_PUBLISHING . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: Pushing entry with ' . count($current) . ' elements to stack ' . self::STACKER_NAME_PENDING_PUBLISHING . ' ...'); $this->getStackInstance()->pushNamed(self::STACKER_NAME_PENDING_PUBLISHING, $current); } // END - while } @@ -188,7 +188,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { $isPending = ($this->getStackInstance()->isStackEmpty(self::STACKER_NAME_PENDING_PUBLISHING) === FALSE); // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT isPending=' . intval($isPending)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: isPending=' . intval($isPending)); return $isPending; } @@ -202,7 +202,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { $isBooting = $this->getStateInstance()->ifDhtIsBooting(); // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT isBooting=' . intval($isBooting)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: isBooting=' . intval($isBooting)); return $isBooting; } @@ -233,9 +233,9 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { assert(is_array($entry)); // Remove any non-public data the database layer desires - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: Calling this->getWrapperInstance()->removeNonPublicDataFromArray(data) ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: Calling this->getWrapperInstance()->removeNonPublicDataFromArray(data) ...'); $entry = $this->getWrapperInstance()->removeNonPublicDataFromArray($entry); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: entry[]=' . gettype($entry)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT: entry[]=' . gettype($entry)); // Some sanity-checks again assert(is_array($entry)); diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index 378cfdad0..ef6de49c6 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -186,18 +186,18 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData())); // Search for the node's session id and external address/hostname + TCP/UDP listen port foreach ($handlerInstance->getSearchData() as $key) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',key=' . $key); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',key=' . $key); // Is it there? assert(isset($messageData[$key])); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData[' . $key . ']=' . $messageData[$key]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData[' . $key . ']=' . $messageData[$key]); // Add criteria $searchInstance->addCriteria(str_replace('my-', '', $key), $messageData[$key]); @@ -247,7 +247,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert((isset($messageData[$excludeKey])) && (isset($messageData[$andKey]))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE)); // Get a search criteria class $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -255,7 +255,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { // Add all keys foreach (explode($separator, $messageData[$andKey]) as $criteria) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: andKey=' . $andKey . ',criteria=' . $criteria); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: andKey=' . $andKey . ',criteria=' . $criteria); // Add it and leave any 'my-' prefix out $searchInstance->addChoiceCriteria(str_replace('my-', '', $andKey), $criteria); @@ -285,7 +285,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert(count($current) > 0); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: current(' . count($current) . ')[' . gettype($current) . ']=' . print_r($current, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: current(' . count($current) . ')[' . gettype($current) . ']=' . print_r($current, TRUE)); /* * Remove some keys as they should not be published. diff --git a/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php b/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php index e0b4d4856..be46013b5 100644 --- a/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php +++ b/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php @@ -89,7 +89,7 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove */ public function discoverUniversalNodeLocatorByConfiguredAddress ($configKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNL-DISCOVERY:configKey=' . $configKey . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNL-DISCOVERY:configKey=' . $configKey . ' - CALLED!'); // Is there cache? if (!isset($GLOBALS[__METHOD__][$configKey])) { @@ -107,7 +107,7 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove } // END - if // Return cached value - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNL-DISCOVERY:configKey=' . $configKey . ',unl=' . $GLOBALS[__METHOD__][$configKey] . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNL-DISCOVERY:configKey=' . $configKey . ',unl=' . $GLOBALS[__METHOD__][$configKey] . ' - EXIT!'); return $GLOBALS[__METHOD__][$configKey]; } diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 6f80c04f5..b34090cdd 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -79,7 +79,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ public function discoverListenerInstance (HandleableProtocol $protocolInstance, array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolInstance=' . $protocolInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolInstance=' . $protocolInstance->__toString() . ' - CALLED!'); /* * Get the listener pool instance, we need to lookup the matching @@ -94,7 +94,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $protocolName = $protocolInstance->getProtocolName(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName); /* * Now we need to choose again. It is whether we are speaking with a hub @@ -103,7 +103,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ foreach ($poolInstance->getArrayFromList($protocolName) as $listenerInstance) { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName . ',listenerInstance[' . gettype($listenerInstance) . ']=' . $listenerInstance); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName . ',listenerInstance[' . gettype($listenerInstance) . ']=' . $listenerInstance); // Make sure the instance is valid assert($listenerInstance instanceof Listenable); @@ -111,16 +111,16 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera // Does the listener want that package? if ($listenerInstance->ifListenerAcceptsPackageData($packageData)) { // This listener likes our package data, so abort here - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Listener is accepting package data.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Listener is accepting package data.'); break; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Listener is NOT accepting package data.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Listener is NOT accepting package data.'); } // END - foreach // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance->__toString()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance->__toString()); // Return it return $listenerInstance; @@ -139,7 +139,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ public function discoverSocket (array $packageData, $connectionType) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': connectionType=' . $connectionType . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-SOCKET-DISOVERY: connectionType=' . $connectionType . ' - CALLED!'); // Assert on type and recipient assert($connectionType != StorableSocket::CONNECTION_TYPE_SERVER); @@ -149,7 +149,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $protocolInstance = ProtocolDiscovery::determineProtocolByPackageData($packageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('protocolInstance=' . $protocolInstance . ',packageData=' . print_r($packageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('protocolInstance=' . $protocolInstance . ',packageData=' . print_r($packageData, TRUE)); // Is it valid? assert($protocolInstance instanceof HandleableProtocol); @@ -164,7 +164,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $listenerInstance = $this->discoverListenerInstance($protocolInstance, $packageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('listenerInstance=' . $listenerInstance . ',packageData=' . print_r($packageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('listenerInstance=' . $listenerInstance . ',packageData=' . print_r($packageData, TRUE)); // If there is no listener who wants to have that package, we simply drop it here if (is_null($listenerInstance)) { @@ -188,7 +188,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera // Try to create a new socket resource try { // Possibly noisy debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Trying to establish a ' . strtoupper($listenerInstance) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Trying to establish a ' . strtoupper($listenerInstance->getProtocolName()) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...'); // Get a socket resource from our factory (if succeeded) $socketInstance = SocketFactory::createSocketFromPackageData($packageData, $protocolInstance); @@ -204,7 +204,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $helperInstance = Registry::getRegistry()->getInstance('connection'); // Possibly noisy debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Going to resolve socket from peer state and given package data ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Going to resolve socket from peer state and given package data ...'); // Resolve the peer's state (but ignore return value) PeerStateResolver::resolveStateByPackage($helperInstance, $packageData, $socketInstance); @@ -217,7 +217,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera } // And return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: socketResource=' . $socketInstance->getSocketResource() . ',packageData=' . print_r($packageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: socketResource=' . $socketInstance->getSocketResource() . ',packageData=' . print_r($packageData, TRUE)); return $socketInstance; } diff --git a/application/hub/classes/factories/locator/class_UniversalNodeLocatorFactory.php b/application/hub/classes/factories/locator/class_UniversalNodeLocatorFactory.php index df00afa0d..fd70f678d 100644 --- a/application/hub/classes/factories/locator/class_UniversalNodeLocatorFactory.php +++ b/application/hub/classes/factories/locator/class_UniversalNodeLocatorFactory.php @@ -46,6 +46,9 @@ class UniversalNodeLocatorFactory extends ObjectFactory { * @return $unlInstance An instance of a LocateableNode class */ public static final function createUnlInstanceFromString ($unl) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('UNL-FACTORY: unl=%s - CALLED!', $unl)); + // If there is no handler? if (Registry::getRegistry()->instanceExists('unl_' . $unl)) { // Get handler from registry diff --git a/application/hub/classes/factories/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index 1fb67772c..5e35ab2b8 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -69,7 +69,7 @@ class SocketFactory extends ObjectFactory { $registryKey = 'socket_' . $protocolInstance->getProtocolName() . '_' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]; // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Trying to find a socket with registryKey=' . $registryKey); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Trying to find a socket with registryKey=' . $registryKey); // Is the key there? if (Registry::getRegistry()->instanceExists($registryKey)) { @@ -77,13 +77,13 @@ class SocketFactory extends ObjectFactory { $socketInstance = Registry::getRegistry()->getInstance($registryKey); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Using socket ' . $socketInstance->getSocketResource() . '(' . gettype($socketInstance->getSocketResource()) . ') from registry.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Using socket ' . $socketInstance->getSocketResource() . '(' . gettype($socketInstance->getSocketResource()) . ') from registry.'); } else { // Construct configuration entry for object factory and get it $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($protocolInstance->getProtocolName() . '_connection_helper_class'); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Going to use class ' . $className . ' for creating a socket resource ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Going to use class ' . $className . ' for creating a socket resource ...'); // And call the static method $socketInstance = call_user_func($className . '::createConnectionFromPackageData', $packageData); @@ -92,9 +92,12 @@ class SocketFactory extends ObjectFactory { Registry::getRegistry()->addInstance($registryKey, $socketInstance); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Socket is now registered in registry.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Socket is now registered in registry.'); } + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return the socket (container) instance return $socketInstance; } @@ -178,6 +181,9 @@ class SocketFactory extends ObjectFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__, array_values($packageData)); } // END - if + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return socket instance return $socketInstance; } @@ -196,7 +202,7 @@ class SocketFactory extends ObjectFactory { $socketResource = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Created socket ' . $socketResource . '(' . gettype($socketResource) . ') from class ' . $className . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Created socket[' . gettype($socketResource) . ']=' . $socketResource . '.'); // Construct container class, this won't be reached if an exception is thrown $socketInstance = ObjectFactory::createObjectByConfiguredName('socket_container_class', array($socketResource, StorableSocket::SOCKET_PROTOCOL_TCP, $packageData)); @@ -235,6 +241,9 @@ class SocketFactory extends ObjectFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__, array('0.0.0.0', '0')); } // END - if + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return it return $socketInstance; } @@ -303,6 +312,9 @@ class SocketFactory extends ObjectFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__, array('0.0.0.0', '0')); } // END - if + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return prepepared socket return $socketInstance; } @@ -364,6 +376,9 @@ class SocketFactory extends ObjectFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__, array('0.0.0.0', '0')); } // END - if + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return prepepared socket return $socketInstance; } @@ -469,6 +484,9 @@ class SocketFactory extends ObjectFactory { $socketInstance->handleSocketError(__METHOD__, __LINE__, array('0.0.0.0', '0')); } // END - if + // Trace message + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: socketInstance=%s - EXIT!', $socketInstance->__toString())); + // Return found socket instance return $socketInstance; } diff --git a/application/hub/classes/factories/states/peer/class_PeerStateFactory.php b/application/hub/classes/factories/states/peer/class_PeerStateFactory.php index 746ccf24b..ae82acdf5 100644 --- a/application/hub/classes/factories/states/peer/class_PeerStateFactory.php +++ b/application/hub/classes/factories/states/peer/class_PeerStateFactory.php @@ -92,13 +92,13 @@ class PeerStateFactory extends ObjectFactory { $tableInstance->purgeOldEntriesBySocketInstance($socketInstance); } catch (InvalidSocketException $e) { // Just log all errors - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Purging of old entries failed. Message from exception: ' . $e->getMessage()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Purging of old entries failed. Message from exception: ' . $e->getMessage()); } // Do we have an entry? if ($tableInstance->isSenderNewPeer($packageData)) { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] errorCode=' . $errorCode); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] errorCode=' . $errorCode); // Register the new peer with its session id $tableInstance->registerPeerByPackageData($packageData, $socketInstance); @@ -113,7 +113,7 @@ class PeerStateFactory extends ObjectFactory { $tableInstance->registerPeerState($stateInstance, $packageData); } elseif ($tableInstance->isSamePeerState($helperInstance, $packageData)) { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state unchanged, re-generating old state ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state unchanged, re-generating old state ...'); /* * The peer's state has noot changed, still we have to return a @@ -122,7 +122,7 @@ class PeerStateFactory extends ObjectFactory { $stateInstance = self::createPeerStateInstanceByName($helperInstance->getPrintableState(), $helperInstance); } else { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Updating peer state ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Updating peer state ...'); /* * It is an already known peer but with a changed state. So first @@ -135,7 +135,7 @@ class PeerStateFactory extends ObjectFactory { } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state has changed from ' . $helperInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . ' (' . $stateInstance->__toString() . ').'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state has changed from ' . $helperInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . ' (' . $stateInstance->__toString() . ').'); // Set the state in the helper $helperInstance->setStateInstance($stateInstance); @@ -157,7 +157,7 @@ class PeerStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName('peer_' . $stateName . '_state_class', array($helperInstance)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state has changed from ' . $helperInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . ' (' . $stateInstance->__toString() . ').'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PEER-STATE-FACTORY[' . __LINE__ . ':] Peer state has changed from ' . $helperInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . ' (' . $stateInstance->__toString() . ').'); // Once we have that state, set it in the peer instance $helperInstance->setStateInstance($stateInstance); @@ -165,7 +165,5 @@ class PeerStateFactory extends ObjectFactory { // For any purposes, return the state instance return $stateInstance; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/feature/hubcoin_reward/class_HubcoinRewardFeature.php b/application/hub/classes/feature/hubcoin_reward/class_HubcoinRewardFeature.php index 9e3b94d5a..14d3b234b 100644 --- a/application/hub/classes/feature/hubcoin_reward/class_HubcoinRewardFeature.php +++ b/application/hub/classes/feature/hubcoin_reward/class_HubcoinRewardFeature.php @@ -63,13 +63,13 @@ class HubcoinRewardFeature extends BaseFeature implements Feature { */ public function isFeatureAvailable () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__)); // Testing this feature is pretty simple: $isAvailable = (($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === TRUE) && (extension_loaded('scrypt')) && (is_callable('scrypt'))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isAvailable=%d - EXIT!', __METHOD__, __LINE__, intval($isAvailable))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isAvailable=%d - EXIT!', __METHOD__, __LINE__, intval($isAvailable))); // Return status return $isAvailable; @@ -87,7 +87,7 @@ class HubcoinRewardFeature extends BaseFeature implements Feature { */ public function featureMethodGenerateHash ($data) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d - CALLED!', __METHOD__, __LINE__, strlen($data))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d - CALLED!', __METHOD__, __LINE__, strlen($data))); // Make sure the feature is available assert(FrameworkFeature::isFeatureAvailable('hubcoin_reward')); @@ -96,7 +96,7 @@ class HubcoinRewardFeature extends BaseFeature implements Feature { $hash = Scrypt::hashScrypt($data); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: hash=%s - EXIT!', __METHOD__, __LINE__, $hash)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: hash=%s - EXIT!', __METHOD__, __LINE__, $hash)); // Return generated hash return $hash; @@ -111,7 +111,7 @@ class HubcoinRewardFeature extends BaseFeature implements Feature { */ public function featureMethodCheckHash ($data, $hash) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d,hash=%s - CALLED!', __METHOD__, __LINE__, strlen($data), $hash)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: data()=%d,hash=%s - CALLED!', __METHOD__, __LINE__, strlen($data), $hash)); // Make sure the feature is available assert(FrameworkFeature::isFeatureAvailable('hubcoin_reward')); @@ -120,12 +120,10 @@ class HubcoinRewardFeature extends BaseFeature implements Feature { $isValid = Scrypt::checkScrypt($data, $hash); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isValid=%d - EXIT!', __METHOD__, __LINE__, intval($isValid))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isValid=%d - EXIT!', __METHOD__, __LINE__, intval($isValid))); // Return status return $isValid; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/filter/class_BaseHubFilter.php b/application/hub/classes/filter/class_BaseHubFilter.php index 5bb5be73b..1189f940c 100644 --- a/application/hub/classes/filter/class_BaseHubFilter.php +++ b/application/hub/classes/filter/class_BaseHubFilter.php @@ -83,7 +83,7 @@ class BaseHubFilter extends BaseFilter { $templateInstance->renderXmlContent($messageContent); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: Handling ' . strlen($messageContent) . ' bytes: ' . $messageContent); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: Handling ' . strlen($messageContent) . ' bytes: ' . $messageContent); /* * The template system now stores all required data as 'general' @@ -108,7 +108,7 @@ class BaseHubFilter extends BaseFilter { } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: key=' . $key . ',value=' . $value); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(str_replace('_', '-', strtoupper($messageType)) . '-TAG: key=' . $key . ',value=' . $value); // Set it now $this->dataXmlNodes[$key] = $value; diff --git a/application/hub/classes/filter/node/class_NodeInitializationFilter.php b/application/hub/classes/filter/node/class_NodeInitializationFilter.php index 94df36328..83a5148f3 100644 --- a/application/hub/classes/filter/node/class_NodeInitializationFilter.php +++ b/application/hub/classes/filter/node/class_NodeInitializationFilter.php @@ -72,11 +72,11 @@ class NodeInitializationFilter extends BaseNodeFilter implements Filterable { } catch (ClassNotFoundException $e) { // This exception means, the node mode is invalid. // @TODO Can we rewrite this to app_exit() ? - $this->debugBackTrace(': node mode ' . $nodeMode . ' is invalid.'); + $this->debugBackTrace(': node mode ' . $requestInstance->getRequestElement('mode') . ' is invalid.'); } // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-INIT-FILTER: Node ' . $nodeMode . ' has been added to registry.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-INIT-FILTER: Node ' . $nodeInstance->__toString() . ' has been added to registry.'); } } diff --git a/application/hub/classes/handler/chunks/class_ChunkHandler.php b/application/hub/classes/handler/chunks/class_ChunkHandler.php index e83314387..b2dbace00 100644 --- a/application/hub/classes/handler/chunks/class_ChunkHandler.php +++ b/application/hub/classes/handler/chunks/class_ChunkHandler.php @@ -143,7 +143,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera */ private function initHandler () { // Noisy debug line: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Initializing handler ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Initializing handler ...'); // Init finalPackageChunks $this->finalPackageChunks = array( @@ -175,7 +175,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera */ private function isChunkHashValid (array $chunkSplits) { // Noisy debug line: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: chunkSplits=' . print_r($chunkSplits, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: chunkSplits=' . print_r($chunkSplits, TRUE)); // Assert on some elements assert(isset($chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA])); @@ -188,7 +188,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $isValid = ($chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] === $chunkHash); // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: chunkHash=' . $chunkHash . ',isValid=' . intval($isValid)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: chunkHash=' . $chunkHash . ',isValid=' . intval($isValid)); // ... and return it return $isValid; @@ -227,7 +227,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ',hash=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ',hash=' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH]); // Add the chunk data (index 2) to the final array and use the serial number as index $this->finalPackageChunks['content'][$chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL]] = $chunkSplits[self::CHUNK_SPLITS_INDEX_RAW_DATA]; @@ -306,7 +306,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera */ private function verifyChunkSerialNumbers () { // Debug message - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: finalPackageChunks=' . print_r($this->finalPackageChunks, TRUE)); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: finalPackageChunks=' . print_r($this->finalPackageChunks, TRUE)); // Get final hash $finalHash = $this->generateFinalHash(implode('', $this->finalPackageChunks['content'])); @@ -320,7 +320,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $nextSerial = $this->fragmenterInstance->getNextHexSerialNumber($finalHash); // Debug output - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $serialNumber . ',nextSerial=' . $nextSerial); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $serialNumber . ',nextSerial=' . $nextSerial); // Is it not the same? Then re-request it if ($serialNumber != $nextSerial) { @@ -349,14 +349,14 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $this->rawPackageData = ''; // That went well, so start assembling all chunks - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Handling ' . count($this->finalPackageChunks['content']) . ' entries ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Handling ' . count($this->finalPackageChunks['content']) . ' entries ...'); foreach ($this->finalPackageChunks['content'] as $serialNumber => $content) { // Assert on 'hash' entry (must always be set) assert(isset($this->finalPackageChunks['hashes'][$serialNumber])); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $serialNumber . ',hashes=' . $this->finalPackageChunks['hashes'][$serialNumber] . ' - validating ...'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('finalPackageChunks=' . print_r($this->finalPackageChunks, TRUE) . 'chunkHashes=' . print_r($this->chunkHashes, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: serialNumber=' . $serialNumber . ',hashes=' . $this->finalPackageChunks['hashes'][$serialNumber] . ' - validating ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('finalPackageChunks=' . print_r($this->finalPackageChunks, TRUE) . 'chunkHashes=' . print_r($this->chunkHashes, TRUE)); // Is this chunk valid? This should be the case assert($this->isChunkHashValid(array( @@ -368,12 +368,12 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera assert(in_array($this->finalPackageChunks['hashes'][$serialNumber], $this->chunkHashes)); // Verification okay, add it to the raw data - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Adding ' . strlen($content) . ' bytes as raw package data ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Adding ' . strlen($content) . ' bytes as raw package data ...'); $this->rawPackageData .= $content; } // END - foreach // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: eopChunk[1]=' . $this->eopChunk[1] . ',index=' . (count($this->chunkHashes) - 2) . ',chunkHashes='.print_r($this->chunkHashes, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: eopChunk[1]=' . $this->eopChunk[1] . ',index=' . (count($this->chunkHashes) - 2) . ',chunkHashes='.print_r($this->chunkHashes, TRUE)); // The last chunk hash must match with the one from eopChunk[1] assert($this->eopChunk[1] == $this->chunkHashes[count($this->chunkHashes) - 2]); @@ -411,7 +411,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $finalHash = $this->generateFinalHash($this->rawPackageData); // Is it the same? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: eopChunk[1]=' . $this->eopChunk[1] . ',finalHash=' . $finalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: eopChunk[1]=' . $this->eopChunk[1] . ',finalHash=' . $finalHash); assert($finalHash == $this->eopChunk[0]); } @@ -429,7 +429,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera $chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunks[count($chunks) - 1]); // Make sure chunks with only 3 elements are parsed (for details see ChunkHandler) - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('eopChunk=' . $chunks[count($chunks) - 1] . ',chunkSplits=' . print_r($chunkSplits, TRUE)); assert(count($chunkSplits) == 3); // Validate final chunk @@ -640,11 +640,11 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera */ public function ifRawPackageDataIsAvailable () { // Check it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: this->rawPackageData()=' . strlen($this->rawPackageData) . ',ifUnassembledChunksAvailable()=' . intval($this->ifUnassembledChunksAvailable())); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: this->rawPackageData()=' . strlen($this->rawPackageData) . ',ifUnassembledChunksAvailable()=' . intval($this->ifUnassembledChunksAvailable())); $isRawPackageDataAvailable = ((!empty($this->rawPackageData)) && (!$this->ifUnassembledChunksAvailable())); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable)); return $isRawPackageDataAvailable; } @@ -659,7 +659,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera assert($this->ifRawPackageDataIsAvailable()); // Then feed it into the next stacker - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Pushing ' . strlen($this->rawPackageData) . ' bytes to stack ' . self::STACKER_NAME_ASSEMBLED_RAW_DATA . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Pushing ' . strlen($this->rawPackageData) . ' bytes to stack ' . self::STACKER_NAME_ASSEMBLED_RAW_DATA . ' ...'); $this->getStackInstance()->pushNamed(self::STACKER_NAME_ASSEMBLED_RAW_DATA, $this->rawPackageData); // ... and reset it diff --git a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php index 1882fb2e3..debb99b65 100644 --- a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php @@ -153,12 +153,12 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, TRUE)); // "Walk" throught the translation array foreach ($this->messageToConfig as $messageKey => $configKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); // Set the element in configuration $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]); @@ -167,7 +167,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl // "Walk" throught the config-copy array foreach ($this->configCopy as $targetKey => $sourceKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); // Copy from source to targetKey $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); @@ -203,7 +203,5 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl // Remove NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS as well $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index f2a4aa328..4f646d72d 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -120,12 +120,12 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme parent::addArrayToDataSet($dataSetInstance, $messageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData=' . print_r($messageData, TRUE)); // Add all ements foreach ($this->messageDataElements as $key) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData[' . $key . ']=' . $messageData[$key]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData[' . $key . ']=' . $messageData[$key]); // Is it there? assert(isset($messageData[$key])); @@ -162,7 +162,5 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index dfaa234bc..61dc2e026 100644 --- a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -144,12 +144,12 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageData=' . print_r($messageData, TRUE)); // "Walk" throught the translation array foreach ($this->messageToConfig as $messageKey => $configKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]); // Set the element in configuration $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]); @@ -158,7 +158,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl // "Walk" throught the config-copy array foreach ($this->configCopy as $targetKey => $sourceKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); // Copy from source to target key $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); @@ -209,7 +209,5 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS); $this->getConfigInstance()->unsetConfigEntry('dht_nodes'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php index e74527a67..ce01a51e6 100644 --- a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -133,12 +133,12 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageData=' . print_r($messageData, TRUE)); // "Walk" throught the config-copy array foreach ($this->configCopy as $targetKey => $sourceKey) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); // Copy from source to targetKey $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); @@ -184,7 +184,5 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS); $this->getConfigInstance()->unsetConfigEntry('node_list'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php index a66f951c4..88a7052a2 100644 --- a/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php +++ b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php @@ -56,13 +56,13 @@ abstract class BaseProtocolHandler extends BaseHubHandler implements HandleableP */ protected final function isValidUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ',regex=' . $regex . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PROTOCOL-HANDLER: unl=' . $unl . ' - CALLED!'); // Very basic regex check $isValid = (preg_match($this->getRegularExpression(), $unl) === 1); // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': isValid=' . intval($isValid) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PROTOCOL-HANDLER: isValid=' . intval($isValid) . ' - EXIT!'); return $isValid; } @@ -111,14 +111,14 @@ abstract class BaseProtocolHandler extends BaseHubHandler implements HandleableP $internalUnl = HubTools::determineOwnInternalAddress(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ',externalUnl=' . $externalUnl . ',internalUnl=' . $internalUnl); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PROTOCOL-HANDLER: unl=' . $unl . ',externalUnl=' . $externalUnl . ',internalUnl=' . $internalUnl); //* DIE-DEBUG: */ die(__METHOD__.':unl=' . $unl . ',this='.print_r($this, TRUE)); // Is it the same? $ifMatches = (($unl === $externalUnl) || ($unl === $internalUnl)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': ifMatches=' . intval($ifMatches)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PROTOCOL-HANDLER: ifMatches=' . intval($ifMatches)); // Return result return $ifMatches; diff --git a/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php b/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php index 2abc2e4a4..be158038b 100644 --- a/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php +++ b/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php @@ -80,7 +80,7 @@ abstract class BaseIpV4ProtocolHandler extends BaseProtocolHandler { */ public function isValidUniversalNodeLocatorByPackageData (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('IPV4-PROTOCOL-HANDLER: CALLED!'); // Is 'recipient' there? assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])); @@ -92,7 +92,7 @@ abstract class BaseIpV4ProtocolHandler extends BaseProtocolHandler { $isValid = $this->isValidUniversalNodeLocator($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': PACKAGE_DATA_RECIPIENT=' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ',isValid[' . gettype($isValid) . ']=' . intval($isValid)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('IPV4-PROTOCOL-HANDLER: PACKAGE_DATA_RECIPIENT=' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ',isValid[' . gettype($isValid) . ']=' . intval($isValid)); // If this doesn't fail, continue validating the IP:port combination if ($isValid === TRUE) { @@ -108,7 +108,7 @@ abstract class BaseIpV4ProtocolHandler extends BaseProtocolHandler { } // END - if // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': isValid=' . intval($isValid) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('IPV4-PROTOCOL-HANDLER: isValid=' . intval($isValid) . ' - EXIT!'); return $isValid; } diff --git a/application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php b/application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php index 3832dc37b..a758a1e74 100644 --- a/application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php +++ b/application/hub/classes/handler/raw_data/tcp/class_TcpRawDataHandler.php @@ -74,7 +74,7 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Handling TCP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Handling TCP package from resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError)); /* * Read the raw data from socket. If you change PHP_BINARY_READ to @@ -87,13 +87,13 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $this->lastSocketError = socket_last_error($socketArray[Poolable::SOCKET_ARRAY_INSTANCE]); // Debug output of read data length - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',error=' . socket_strerror($this->lastSocketError)); - //* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData=' . $rawData); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE] . ',error=' . socket_strerror($this->lastSocketError)); + /* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData=' . $rawData); // Is it valid? if ($this->lastSocketError == 11) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]); /* * Error code 11 (Resource temporary unavailable) can be safely @@ -117,7 +117,7 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { * well-formed BASE64-encoded message with start and markers. This * will be checked later on. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Adding ' . strlen($rawData) . ' bytes to stacker ...'); $this->addRawDataToStacker($rawData); } } diff --git a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php index 1fd16faff..9cc478d70 100644 --- a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php @@ -180,7 +180,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg */ private function getRawDataFromPackageArray (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: currentFinalHash=' . $this->currentFinalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: currentFinalHash=' . $this->currentFinalHash); // Make sure the final hash is set assert((is_string($this->currentFinalHash)) && (!empty($this->currentFinalHash))); @@ -189,25 +189,25 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg $rawDataChunk = $this->getFragmenterInstance()->getNextRawDataChunk($this->currentFinalHash); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: rawDataChunk=' . print_r($rawDataChunk, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: rawDataChunk=' . print_r($rawDataChunk, TRUE)); // Get chunk hashes and chunk data $chunkHashes = array_keys($rawDataChunk); $chunkData = array_values($rawDataChunk); // Is the required data there? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('chunkData='.print_r($chunkData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('chunkData='.print_r($chunkData, TRUE)); if ((isset($chunkHashes[0])) && (isset($chunkData[0]))) { // Remember this chunk as queued $this->queuedChunks[$chunkHashes[0]] = $chunkData[0]; // Return the raw data - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning ' . strlen($chunkData[0]) . ' bytes from ' . __METHOD__ . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning ' . strlen($chunkData[0]) . ' bytes from ' . __METHOD__ . ' ...'); return $chunkData[0]; } else { // Return zero string - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning zero bytes from ' . __METHOD__ . '!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning zero bytes from ' . __METHOD__ . '!'); return ''; } } @@ -219,8 +219,14 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg * @return void */ public function accept (Visitor $visitorInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: visitorInstance=%s - CALLED!', $visitorInstance->__toString())); + // Just call the visitor $visitorInstance->visitConnectionHelper($this); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: EXIT!'); } /** @@ -230,16 +236,22 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg * @return void */ public function sendRawPackageData (array $packageData) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: packageData()=%d - CALLED!', count($packageData))); + // The helper's state must be 'connected' $this->getStateInstance()->validatePeerStateConnected(); // Implode the package data array and fragement the resulting string, returns the final hash $finalHash = $this->getFragmenterInstance()->fragmentPackageArray($packageData, $this); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: finalHash[%s]=%s', gettype($finalHash), $finalHash)); + // Is the final hash set? if ($finalHash !== TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Setting finalHash=' . $finalHash . ',currentFinalHash[' . gettype($this->currentFinalHash) . ']=' . $this->currentFinalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Setting finalHash=' . $finalHash . ',currentFinalHash[' . gettype($this->currentFinalHash) . ']=' . $this->currentFinalHash); // Set final hash $this->currentFinalHash = $finalHash; @@ -253,27 +265,43 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg $dataStream = ' '; // Fill sending buffer with data - while (strlen($dataStream) > 0) { + while (TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: packageData=' . print_r($packageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: dataStream()=%d', strlen($dataStream))); // Convert the package data array to a raw data stream $dataStream = $this->getRawDataFromPackageArray($packageData); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); + + // Is it empty? + if (strlen($dataStream) == 0) { + // Abort here + break; + } // END - if + + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); + + // Add raw data $rawData .= $dataStream; } // END - while + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: rawData()=%d', strlen($rawData))); + // Nothing to sent is bad news, so assert on it assert(strlen($rawData) > 0); // Calculate buffer size $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length'); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: bufferSize=%d', $bufferSize)); + // Encode the raw data with our output-stream $encodedData = $this->getOutputStreamInstance()->streamData($rawData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: socketResource[]=' . gettype($this->getSocketInstance()->getSocketResource()) . PHP_EOL); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: socketResource[]=' . gettype($this->getSocketInstance()->getSocketResource())); // Init array $encodedDataArray = array( @@ -288,8 +316,14 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg // Calculate difference $diff = $encodedDataArray[NetworkPackage::RAW_INDEX_BUFFER_SIZE] - strlen($encodedDataArray[NetworkPackage::RAW_INDEX_ENCODED_DATA]); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: diff=' . $diff); + // Push raw data to the package's outgoing stack $this->getPackageInstance()->getStackInstance()->pushNamed(NetworkPackage::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: EXIT!'); } /** @@ -298,7 +332,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg * @return $shuttedDown Whether this connection is shutted down */ public final function isShuttedDown () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ',shuttedDown=' . intval($this->shuttedDown)); return $this->shuttedDown; } diff --git a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php index ec16978f6..877f08556 100644 --- a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php @@ -141,7 +141,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { * @return void */ protected final function markConnectionShuttedDown () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ' has been marked as shutted down'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: ' . $this->__toString() . ' has been marked as shutted down'); $this->shuttedDown = TRUE; // And remove the (now invalid) socket diff --git a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php index afd3b8de5..6df429e11 100644 --- a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php +++ b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php @@ -97,7 +97,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { */ public function sendPackage (Distributable $dhtInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: CALLED!'); /* * Sanity check: Is the DHT in the approx. state? 'init' for bootstrap @@ -116,7 +116,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { $packageInstance->enqueueRawDataFromTemplate($this); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: EXIT!'); } } diff --git a/application/hub/classes/info/connection/class_ConnectionInfo.php b/application/hub/classes/info/connection/class_ConnectionInfo.php index 50319ec8f..13510d06e 100644 --- a/application/hub/classes/info/connection/class_ConnectionInfo.php +++ b/application/hub/classes/info/connection/class_ConnectionInfo.php @@ -66,7 +66,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { */ public function fillWithListenerInformation (Listenable $listenerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': protocolName=' . $listenerInstance->getProtocolName() . ',listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-INFO: protocolName=' . $listenerInstance->getProtocolName() . ',listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); // Fill the generic array with several data from the listener: $this->setProtocolName($listenerInstance->getProtocolName()); @@ -77,7 +77,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { $this->setListenerInstance($listenerInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-INFO: EXIT!'); } /** @@ -88,7 +88,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { */ public function fillWithConnectionHelperInformation (ConnectionHelper $helperInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': protocolName=' . $helperInstance->getProtocolName() . ',helperInstance=' . $helperInstance->__toString() . ',socketResource=' . $helperInstance->getSocketResource() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-INFO: protocolName=' . $helperInstance->getProtocolName() . ',helperInstance=' . $helperInstance->__toString() . ',socketResource=' . $helperInstance->getSocketResource() . ' - CALLED!'); // Fill the generic array with several data from the listener: $this->setProtocolName($helperInstance->getSocketInstance()->getSocketProtocol()); @@ -99,7 +99,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { $this->setHelperInstance($helperInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-INFO: EXIT!'); } /** diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index a7bf4602b..90fe089b3 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -219,7 +219,7 @@ class BaseListener extends BaseHubSystem implements Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); // Visit this listener $visitorInstance->visitListener($this); @@ -230,7 +230,7 @@ class BaseListener extends BaseHubSystem implements Visitable { } // END - if // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); } /** @@ -307,7 +307,7 @@ class BaseListener extends BaseHubSystem implements Visitable { $currentSocketData = $this->getIteratorInstance()->current(); // Handle it here, if not main server socket - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: currentSocketData=' . $currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: currentSocketData=' . $currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource()); if (($currentSocketData[Poolable::SOCKET_ARRAY_CONN_TYPE] != StorableSocket::CONNECTION_TYPE_SERVER) && (!$currentSocketData[Poolable::SOCKET_ARRAY_INSTANCE]->equals($this->getSocketInstance()))) { // ... or else it will raise warnings like 'Transport endpoint is not connected' $this->getHandlerInstance()->processRawDataFromResource($currentSocketData); diff --git a/application/hub/classes/listener/class_BaseListenerDecorator.php b/application/hub/classes/listener/class_BaseListenerDecorator.php index b94ee0180..63c6ec3c8 100644 --- a/application/hub/classes/listener/class_BaseListenerDecorator.php +++ b/application/hub/classes/listener/class_BaseListenerDecorator.php @@ -135,6 +135,9 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { * @return void */ public function monitorIncomingRawData () { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: CALLED!'); + // Get the handler instance $handlerInstance = $this->getListenerInstance()->getHandlerInstance(); @@ -145,13 +148,14 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { */ if (!$handlerInstance instanceof Networkable) { // Skip this silently for now. Later on, this will become mandatory! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('No handler assigned to this listener decorator. this=' . $this->__toString() . ', listenerInstance=' . $this->getListenerInstance()->__toString()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: No handler assigned to this listener decorator. this=' . $this->__toString() . ', listenerInstance=' . $this->getListenerInstance()->__toString()); return; } // END - if // 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('LISTENER-DECORATOR: No data pending on handlerInstance=' . $handlerInstance->__toString() . ' - EXIT!'); return; } // END - if @@ -165,8 +169,11 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { * know if the decoded data origins from a TCP or UDP connection so it * can just be passed over to the network package receiver. */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LISTENER-DECORATOR Going to handle over some raw data to receiver instance (' . $receiverInstance->__toString() . ') ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: Going to handle over some raw data to receiverInstance=' . $receiverInstance->__toString() . ' ...'); $receiverInstance->addRawDataToIncomingStack($handlerInstance); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-DECORATOR: EXIT!'); } /** diff --git a/application/hub/classes/listener/socket/decorator/class_SocketFileListenerDecorator.php b/application/hub/classes/listener/socket/decorator/class_SocketFileListenerDecorator.php index a56d29c14..afbb779a5 100644 --- a/application/hub/classes/listener/socket/decorator/class_SocketFileListenerDecorator.php +++ b/application/hub/classes/listener/socket/decorator/class_SocketFileListenerDecorator.php @@ -3,6 +3,7 @@ namespace Hub\Listener\Socket; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Factory\Tag\Package\PackageTagsFactory; use Hub\Listener\BaseListenerDecorator; use Hub\Listener\Listenable; @@ -43,7 +44,7 @@ class SocketFileListenerDecorator extends BaseListenerDecorator implements Liste // Set listener type and protocol name $this->setListenerType('hub'); - $this->setProtocolName('tcp'); + $this->setProtocolName(StorableSocket::SOCKET_PROTOCOL_FILE); } /** diff --git a/application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php b/application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php index 82d61a4fc..7f387d6ee 100644 --- a/application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php +++ b/application/hub/classes/listener/tcp/decorators/class_ClientTcpListenerDecorator.php @@ -3,6 +3,7 @@ namespace Hub\Listener\Client\Tcp; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Factory\Tag\Package\PackageTagsFactory; use Hub\Listener\BaseListenerDecorator; use Hub\Listener\Listenable; @@ -43,7 +44,7 @@ class ClientTcpListenerDecorator extends BaseListenerDecorator implements Listen // Set listener type and protocol name $this->setListenerType('peer'); - $this->setProtocolName('tcp'); + $this->setProtocolName(StorableSocket::SOCKET_PROTOCOL_TCP); } /** diff --git a/application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php b/application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php index 748a5cf8e..e25230176 100644 --- a/application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php +++ b/application/hub/classes/listener/tcp/decorators/class_HubTcpListenerDecorator.php @@ -3,6 +3,7 @@ namespace Hub\Listener\Hub\Tcp; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Factory\Tag\Package\PackageTagsFactory; use Hub\Listener\BaseListenerDecorator; use Hub\Listener\Listenable; @@ -43,7 +44,7 @@ class HubTcpListenerDecorator extends BaseListenerDecorator implements Listenabl // Set listener type and protocol name $this->setListenerType('hub'); - $this->setProtocolName('tcp'); + $this->setProtocolName(StorableSocket::SOCKET_PROTOCOL_TCP); } /** diff --git a/application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php b/application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php index f43a3b96c..2737c57a8 100644 --- a/application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php +++ b/application/hub/classes/listener/udp/decorators/class_ClientUdpListenerDecorator.php @@ -3,6 +3,7 @@ namespace Hub\Listener\Client\Udp; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Factory\Tag\Package\PackageTagsFactory; use Hub\Listener\BaseListenerDecorator; use Hub\Listener\Listenable; @@ -43,7 +44,7 @@ class ClientUdpListenerDecorator extends BaseListenerDecorator implements Listen // Set listener type and protocol name $this->setListenerType('peer'); - $this->setProtocolName('udp'); + $this->setProtocolName(StorableSocket::SOCKET_PROTOCOL_UDP); } /** diff --git a/application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php b/application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php index a47f0e02e..eaaa9d0e2 100644 --- a/application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php +++ b/application/hub/classes/listener/udp/decorators/class_HubUdpListenerDecorator.php @@ -3,6 +3,7 @@ namespace Hub\Listener\Hub\Udp; // Import application-specific stuff +use Hub\Container\Socket\StorableSocket; use Hub\Factory\Tag\Package\PackageTagsFactory; use Hub\Listener\BaseListenerDecorator; use Hub\Listener\Listenable; @@ -43,7 +44,7 @@ class HubUdpListenerDecorator extends BaseListenerDecorator implements Listenabl // Set listener type and protocol name $this->setListenerType('hub'); - $this->setProtocolName('udp'); + $this->setProtocolName(StorableSocket::SOCKET_PROTOCOL_UDP); } /** diff --git a/application/hub/classes/locator/class_UniversalNodeLocator.php b/application/hub/classes/locator/class_UniversalNodeLocator.php index b4b51f95e..fb32da8da 100644 --- a/application/hub/classes/locator/class_UniversalNodeLocator.php +++ b/application/hub/classes/locator/class_UniversalNodeLocator.php @@ -169,6 +169,9 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi * @return void */ public function parseStringAsUnl ($unl) { + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('UNIVERSAL-NODE-LOCATOR: unl=[%s]=%s - CALLED!', gettype($unl), $unl)); + // Is it basically valid? if (!is_string($unl)) { // Abort here @@ -210,7 +213,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi */ private function parseUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('UNIVERSAL-NODE-LOCATOR: unl=[%s]=%s - CALLED!', gettype($unl), $unl)); // Make sure the UNL is valid if (!$this->isValidUniversalNodeLocator($unl)) { @@ -235,7 +238,7 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNIVERSAL-NODE-LOCATOR: unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); // Call init method $this->initUniversalNodeLocator($unlData); @@ -284,13 +287,13 @@ class UniversalNodeLocator extends BaseHubSystem implements LocateableNode, Regi */ private final function isValidUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ',regex=' . $regex . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNIVERSAL-NODE-LOCATOR: unl=' . $unl . ' - CALLED!'); // Very basic regex check $isValid = (preg_match($this->getRegularExpression(), $unl) === 1); // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': isValid=' . intval($isValid) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UNIVERSAL-NODE-LOCATOR: isValid=' . intval($isValid) . ' - EXIT!'); return $isValid; } diff --git a/application/hub/classes/nodes/boot/class_HubBootNode.php b/application/hub/classes/nodes/boot/class_HubBootNode.php index d8acae0b6..b78ad4f5a 100644 --- a/application/hub/classes/nodes/boot/class_HubBootNode.php +++ b/application/hub/classes/nodes/boot/class_HubBootNode.php @@ -73,7 +73,7 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable { $unl = $this->detectOwnUniversalNodeLocator(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-BOOT-NODE: unl=' . $unl); // Now check if the IP address matches one of the bootstrap nodes if ($this->ifAddressMatchesBootstrapNodes($unl)) { @@ -141,7 +141,5 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable { // Register it $handlerInstance->registerTask('dht_bootstrap', $taskInstance); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 44d292890..9f1597154 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -683,13 +683,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function ifNodeIsAnnouncing () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): state=' . $this->getStateInstance()->getStateName()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): state=' . $this->getStateInstance()->getStateName()); // Simply check the state of this node $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncingState); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); // Return it return $hasAnnounced; @@ -703,13 +703,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function ifNodeHasAnnouncementCompleted () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); // Simply check the state of this node $hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); // Return it return $hasAnnouncementCompleted; @@ -760,7 +760,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function determineUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is there cache? if (!isset($GLOBALS[__METHOD__])) { @@ -773,7 +773,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { } // END - if // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unlInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unlInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!'); return $GLOBALS[__METHOD__]; } diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index 75f3a4ac5..b21adaf75 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -117,7 +117,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $isInputBufferEmpty = $this->getPackageInstance()->getStackInstance()->isStackEmpty(NetworkPackage::STACKER_NAME_DECODED_HANDLED); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: isInputBufferEmpty=' . intval($isInputBufferEmpty)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: isInputBufferEmpty=' . intval($isInputBufferEmpty)); // Return it return $isInputBufferEmpty; @@ -186,7 +186,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ private function handlePackageByUnhandledPackage (array $packageContent) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_RAW_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageData[' . BaseRawDataHandler::PACKAGE_RAW_DATA . ']=' . $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); // Check for some conditions if ((!$this->ifInputBufferIsEmpty()) || (!$this->isPackageContentCompleted($packageContent))) { @@ -194,10 +194,10 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $this->pendingData .= $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Partial data received. Waiting for more ... ( ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes)'); } else { // Debug message - //* DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ': packageContent=' . print_r($packageContent, TRUE) . ',chunks='.print_r($chunks, TRUE)); + //* DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: packageContent=' . print_r($packageContent, TRUE) . ',chunks='.print_r($chunks, TRUE)); } } @@ -224,8 +224,10 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, // Determine it $isPending = (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_MULTIPLE_MESSAGE)); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: isPending=' . intval($isPending) . ' - EXIT!'); + // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ': isPending=' . intval($isPending)); return $isPending; } @@ -236,7 +238,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ public function handlePendingData () { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to decode ' . strlen($this->pendingData) . ' Bytes of pending data. pendingData=' . $this->pendingData); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to decode ' . strlen($this->pendingData) . ' Bytes of pending data. pendingData=' . $this->pendingData); // Assert on condition assert(!$this->isPendingDataEmpty()); @@ -244,8 +246,8 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, // No markers set? if (!$this->ifStartEndMarkersSet($this->pendingData)) { // This will cause an assertition in next call, so simply wait for more data - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Pending data of ' . strlen($this->pendingData) . ' Bytes are incomplete, waiting for more ...'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: this->pendingData=' . $this->pendingData); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Pending data of ' . strlen($this->pendingData) . ' Bytes are incomplete, waiting for more ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: this->pendingData=' . $this->pendingData); return; } elseif (substr_count($this->pendingData, BaseRawDataHandler::STREAM_START_MARKER) > 1) { /* @@ -280,7 +282,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $this->clearPendingData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.'); // Make sure last CHUNK_SEPARATOR is not there if (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { @@ -296,7 +298,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $chunks = explode(PackageFragmenter::CHUNK_SEPARATOR, $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]); // Add all chunks because the last final chunk is found - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to add ' . count($chunks) . ' to chunk handler ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: Going to add ' . count($chunks) . ' to chunk handler ...'); $this->getHandlerInstance()->addAllChunksWithFinal($chunks); } diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index bb38964ea..80ef74715 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -403,7 +403,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Is an entry found? if (count($senderData) > 0) { // Make sure the element 'private_key_hash' is there - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderData=' . print_r($senderData, TRUE)); + /* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderData=' . print_r($senderData, TRUE)); assert(isset($senderData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH])); // Don't accept empty hashes @@ -438,7 +438,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function getHashFromContent ($content) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); // Create the hash // @TODO md5() is very weak, but it needs to be fast @@ -451,7 +451,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',hash=' . $hash . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($content) . ',sender=' . $this->getSessionId() . ',hash=' . $hash . ',compressor=' . $this->getCompressorInstance()->getCompressorExtension()); // And return it return $hash; @@ -512,7 +512,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function getHashFromContentSessionId (array $decodedContent, $sessionId) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($decodedContent[self::PACKAGE_CONTENT_MESSAGE]) . ',sender=' . $sessionId . ',compressor=' . $decodedContent[self::PACKAGE_CONTENT_EXTENSION]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content[md5]=' . md5($decodedContent[self::PACKAGE_CONTENT_MESSAGE]) . ',sender=' . $sessionId . ',compressor=' . $decodedContent[self::PACKAGE_CONTENT_EXTENSION]); // Create the hash // @TODO md5() is very weak, but it needs to be fast @@ -622,11 +622,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $socketInstance = $discoveryInstance->discoverSocket($packageData, StorableSocket::CONNECTION_TYPE_OUTGOING); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: stateInstance=' . $helperInstance->getStateInstance()); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); // The socket needs to be put in a special registry that can handle such data $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); @@ -634,6 +630,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Get the connection helper from registry $helperInstance = Registry::getRegistry()->getInstance('connection'); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: stateInstance=' . $helperInstance->getStateInstance()); + // And make sure it is valid assert($helperInstance instanceof ConnectionHelper); @@ -643,10 +642,13 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Will the info instance with connection helper data $infoInstance->fillWithConnectionHelperInformation($helperInstance); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); + // Is it not there? if (($socketInstance->isValidSocket()) && (!$registryInstance->isSocketRegistered($infoInstance, $socketInstance))) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...'); // Then register it $registryInstance->registerSocketInstance($infoInstance, $socketInstance, $packageData); @@ -659,19 +661,19 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after isSocketRegistered() has been called.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after isSocketRegistered() has been called.'); // Make sure the connection is up $helperInstance->getStateInstance()->validatePeerStateConnected(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after validatePeerStateConnected() has been called.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: 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->getStackInstance()->pushNamed(self::STACKER_NAME_OUTGOING, $packageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after pushNamed() has been called.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Reached line ' . __LINE__ . ' after pushNamed() has been called.'); } /** @@ -718,12 +720,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function generatePackageHash ($content, $senderId) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content()=' . strlen($content) . ',senderId=' . $senderId . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: content()=' . strlen($content) . ',senderId=' . $senderId . ' - CALLED!'); // Is the feature enabled? if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) { // Feature is not enabled - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Feature "hubcoin_reward" not available, not generating package hash. Returning NULL ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Feature "hubcoin_reward" not available, not generating package hash. Returning NULL ...'); return NULL; } // END - if @@ -735,11 +737,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R ); // Hash content and sender id together, use scrypt - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderId=' . $senderId . ',content()=' . strlen($content)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderId=' . $senderId . ',content()=' . strlen($content)); $hash = FrameworkFeature::callFeature('hubcoin_reward', 'generateHash', array($senderId . ':' . $content . ':' . $this->determineSenderPrivateKeyHash($data))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: hash=' . $hash . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: hash=' . $hash . ' - EXIT!'); // Return it return $hash; @@ -755,7 +757,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function isPackageHashValid (array $decodedArray) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: decodedArray=' . print_r($decodedArray, TRUE) . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: decodedArray=' . print_r($decodedArray, TRUE) . ' - CALLED!'); // Make sure the required array elements are there assert(isset($decodedArray[self::PACKAGE_CONTENT_SENDER])); @@ -766,17 +768,17 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Is the feature enabled? if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) { // Feature is not enabled, so hashes are always valid - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Feature "hubcoin_reward" not available, not checking hash. Returning TRUE ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Feature "hubcoin_reward" not available, not checking hash. Returning TRUE ...'); return TRUE; } // END - if // Check validity - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderId=' . $decodedArray[self::PACKAGE_CONTENT_SENDER] . ',message()=' . strlen($decodedArray[self::PACKAGE_CONTENT_MESSAGE]) . ',hash=' . $decodedArray[self::PACKAGE_CONTENT_HASH]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: senderId=' . $decodedArray[self::PACKAGE_CONTENT_SENDER] . ',message()=' . strlen($decodedArray[self::PACKAGE_CONTENT_MESSAGE]) . ',hash=' . $decodedArray[self::PACKAGE_CONTENT_HASH]); //* DEBUG-DIE: */ die(__METHOD__ . ': decodedArray=' . print_r($decodedArray, TRUE)); $isHashValid = FrameworkFeature::callFeature('hubcoin_reward', 'checkHash', array($decodedArray[self::PACKAGE_CONTENT_SENDER] . ':' . $decodedArray[self::PACKAGE_CONTENT_MESSAGE] . ':' . $this->determineSenderPrivateKeyHash($decodedArray), $decodedArray[self::PACKAGE_CONTENT_HASH])); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: isHashValid=' . intval($isHashValid) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: isHashValid=' . intval($isHashValid) . ' - EXIT!'); return $isHashValid; } @@ -790,11 +792,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function enqueueRawDataFromTemplate (HubHelper $helperInstance) { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!'); // Get the raw content ... $content = $helperInstance->getTemplateInstance()->getRawTemplateData(); - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('content(' . strlen($content) . ')=' . $content); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('content(' . strlen($content) . ')=' . $content); // ... and compress it $compressed = $this->getCompressorInstance()->compressStream($content); @@ -818,7 +820,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R ); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': Enqueueing package for recipientType=' . $helperInstance->getRecipientType() . ' ...'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Enqueueing package for recipientType=' . $helperInstance->getRecipientType() . ' ...'); // Now prepare the temporary array and push it on the 'undeclared' stack $this->getStackInstance()->pushNamed(self::STACKER_NAME_UNDECLARED, array( @@ -831,7 +833,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R )); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /** @@ -843,6 +845,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Check whether the stacker is not empty $isEnqueued = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_UNDECLARED)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_UNDECLARED))); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isEnqueued=%d - EXIT!', intval($isEnqueued))); + // Return the result return $isEnqueued; } @@ -856,6 +861,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Check whether the stacker is not empty $isDeclared = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_DECLARED)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_DECLARED))); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isDeclared=%d - EXIT!', intval($isDeclared))); + // Return the result return $isDeclared; } @@ -869,6 +877,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Check whether the stacker is not empty $isWaitingDelivery = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING))); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isWaitingDelivery=%d - EXIT!', intval($isWaitingDelivery))); + // Return the result return $isWaitingDelivery; } @@ -882,6 +893,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Check whether the stacker is not empty $isPending = (($this->getStackInstance()->isStackInitialized(self::STACKER_NAME_OUTGOING_STREAM)) && (!$this->getStackInstance()->isStackEmpty(self::STACKER_NAME_OUTGOING_STREAM))); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: isPending=%d - EXIT!', intval($isPending))); + // Return the result return $isPending; } @@ -898,7 +912,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function declareEnqueuedPackage () { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!'); // Make sure this method isn't working if there is no package enqueued if (!$this->isPackageEnqueued()) { @@ -917,7 +931,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->declareRawPackageData($packageData); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /** @@ -929,7 +943,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function processDeclaredPackage () { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!'); // Sanity check if we have packages declared if (!$this->isPackageDeclared()) { @@ -960,7 +974,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /** @@ -970,7 +984,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function sendWaitingPackage () { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!'); // Sanity check if we have packages waiting for delivery if (!$this->isPackageWaitingForDelivery()) { @@ -997,7 +1011,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /** @@ -1007,7 +1021,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function sendEncodedData () { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: CALLED!'); // Make sure there is pending encoded data assert($this->isEncodedDataPending()); @@ -1019,23 +1033,30 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $sentBytes = 0; // Assert on socket instance + assert(isset($encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE])); assert($encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE] instanceof StorableSocket); assert($encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE]->isValidSocket()); + // Trace message + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: Calling socketInstance->writeBufferToSocketByArray(%d,%d) ...', count($encodedDataArray), $sentBytes)); + // And deliver it if (!$encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE]->writeBufferToSocketByArray($encodedDataArray, $sentBytes)) { // Something bad happened while writing to socket $encodedDataArray[self::RAW_INDEX_SOCKET_INSTANCE]->handleSocketError(__METHOD__, __LINE__, array('0.0.0.0', '0')); } // END - if + // Debug message + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: sentBytes[%s]=%d', gettype($sentBytes), $sentBytes)); + // If there was an error, don't continue here if (($sentBytes === 0) && (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) > 0)) { // Nothing sent means all data has been sent - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; } elseif (strlen($encodedDataArray[self::RAW_INDEX_ENCODED_DATA]) <= 0) { // Abort here, all sent! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; } @@ -1043,7 +1064,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->pushNamed(self::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ': EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: EXIT!'); } /////////////////////////////////////////////////////////////////////////// @@ -1098,7 +1119,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R } // END - if // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Stacker size is ' . $this->getStackInstance()->getStackCount(self::STACKER_NAME_DECODED_INCOMING) . ' entries.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Stacker size is ' . $this->getStackInstance()->getStackCount(self::STACKER_NAME_DECODED_INCOMING) . ' entries.'); // "Pop" the next entry (the same array again) from the stack $decodedData = $this->getStackInstance()->popNamed(self::STACKER_NAME_DECODED_INCOMING); @@ -1114,7 +1135,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__, __LINE__)->debugOutput('NETWORK-PACKAGE: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . StorableSocket::SOCKET_ERROR_UNHANDLED . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . StorableSocket::SOCKET_ERROR_UNHANDLED . ')'); assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == StorableSocket::SOCKET_ERROR_UNHANDLED); // Remove the last chunk SEPARATOR (because there is no need for it) @@ -1124,7 +1145,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__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes to stack ' . self::STACKER_NAME_DECODED_HANDLED . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($decodedData[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes to stack ' . self::STACKER_NAME_DECODED_HANDLED . ' ...'); $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_HANDLED, $decodedData); } @@ -1142,7 +1163,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $decodedData = $handlerInstance->getNextRawData(); // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: decodedData[' . gettype($decodedData) . ']=' . print_r($decodedData, TRUE)); // And push it on our stack $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_INCOMING, $decodedData); @@ -1236,7 +1257,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->popNamed(self::STACKER_NAME_DECODED_HANDLED); // ... and push it on the 'chunked' stacker - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes on stack ' . self::STACKER_NAME_DECODED_CHUNKED . ',packageContent=' . print_r($packageContent, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Pushing ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes on stack ' . self::STACKER_NAME_DECODED_CHUNKED . ',packageContent=' . print_r($packageContent, TRUE)); $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECODED_CHUNKED, $packageContent); } @@ -1248,7 +1269,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); // Visit the package $visitorInstance->visitNetworkPackage($this); @@ -1257,7 +1278,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getAssemblerInstance()->accept($visitorInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); } /** @@ -1270,7 +1291,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->initStacks(TRUE); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: All stacker have been re-initialized.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: All stacker have been re-initialized.'); } /** @@ -1454,7 +1475,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__, __LINE__)->debugOutput('NETWORK-PACKAGE: messageArray=' . print_r($messageArray, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: messageArray=' . print_r($messageArray, TRUE)); // Create a handler instance from given message type $handlerInstance = MessageTypeHandlerFactory::createMessageTypeHandlerInstance($messageArray[self::MESSAGE_ARRAY_TYPE]); diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index 1aee48e68..e9848fc28 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -232,7 +232,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert(strlen($finalHash) > 0); // Is the pointer already initialized? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); assert(isset($this->chunkPointers[$finalHash])); // Return it @@ -249,7 +249,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert(isset($this->chunkPointers[$finalHash])); // Count one up - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); $this->chunkPointers[$finalHash]++; } @@ -314,7 +314,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera $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); @@ -335,7 +335,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Calculate real (data) chunk size $dataChunkSize = $this->getDataChunkSizeFromHash($finalHash); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: dataChunkSize=' . $dataChunkSize); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: dataChunkSize=' . $dataChunkSize); // Init variables $chunkHash = ''; @@ -351,7 +351,7 @@ 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); @@ -378,18 +378,18 @@ 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) . '/' . NetworkPackage::TCP_PACKAGE_SIZE . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: assert: ' . strlen($rawData) . '/' . NetworkPackage::TCP_PACKAGE_SIZE . ' ...'); // @TODO This assert broke packages where the hash chunk was very large: assert(strlen($rawData) <= NetworkPackage::TCP_PACKAGE_SIZE); // Add it to the array if ($prepend === TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Prepending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: 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: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Appending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: Appending ' . strlen($rawData) . ' bytes of a chunk, finalHash=' . $finalHash . ' ...'); // Is the array there? if (!isset($this->chunks[$finalHash])) { @@ -430,14 +430,14 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera assert($this->serialNumber[$finalHash] <= $this->maxSerialNumber); // Encode the current serial number - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: serialNumber[' . $finalHash . ']=' . $this->serialNumber[$finalHash]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: serialNumber[' . $finalHash . ']=' . $this->serialNumber[$finalHash]); $encodedSerialNumber = $this->dec2Hex($this->serialNumber[$finalHash], self::MAX_SERIAL_LENGTH); // Count one up $this->serialNumber[$finalHash]++; // Return the encoded serial number - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: encodedSerialNumber=' . $encodedSerialNumber); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: encodedSerialNumber=' . $encodedSerialNumber); return $encodedSerialNumber; } @@ -482,7 +482,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera } // Return final hash - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); return $finalHash; } @@ -497,7 +497,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function getNextRawDataChunk ($finalHash) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); try { // Get current chunk index @@ -516,12 +516,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: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ' - No more entries found!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ' - No more entries found!'); return array(); } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ',chunkHashes()=' . count($this->chunkHashes[$finalHash]) .' - Entry choosen ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(__METHOD__. ': finalHash=' . $finalHash . ',current=' . $current . ',chunkHashes()=' . count($this->chunkHashes[$finalHash]) .' - Entry choosen ...'); // Generate the array $rawDataChunk = array( diff --git a/application/hub/classes/pools/class_BasePool.php b/application/hub/classes/pools/class_BasePool.php index 39aca2d9e..935a0e62d 100644 --- a/application/hub/classes/pools/class_BasePool.php +++ b/application/hub/classes/pools/class_BasePool.php @@ -64,7 +64,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { */ protected final function addInstance ($group, $poolName, Visitable $visitableInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!'); // Make sure the group is not 'invalid' assert($group != 'invalid'); @@ -79,7 +79,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { $this->getPoolEntriesInstance()->addInstance($group, $poolName, $visitableInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: EXIT!'); } /** @@ -123,7 +123,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); // Visit this pool $visitorInstance->visitPool($this); @@ -151,7 +151,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { // Is this entry visitable? if ($poolEntry instanceof Visitable) { // Visit this entry as well - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-POOL: Going to visit pooled object ' . $poolEntry->__toString() . ' with visitor ' . $visitorInstance->__toString() . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Going to visit pooled object ' . $poolEntry->__toString() . ' with visitor ' . $visitorInstance->__toString() . ' ...'); $poolEntry->accept($visitorInstance); } else { // Cannot visit this entry @@ -163,7 +163,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { } // END - while // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); } /** diff --git a/application/hub/classes/pools/listener/class_DefaultListenerPool.php b/application/hub/classes/pools/listener/class_DefaultListenerPool.php index 268acd06f..f95ea003a 100644 --- a/application/hub/classes/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/classes/pools/listener/class_DefaultListenerPool.php @@ -64,12 +64,16 @@ class DefaultListenerPool extends BasePool implements PoolableListener { * @return void */ public function addListener (Listenable $listenerInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('DEFAULT-LISTENER-POOL: listenerInstance=%s - CALLED!', $listenerInstance->__toString())); + // Add this listener instance to the instance list parent::addInstance($listenerInstance->getProtocolName(), 'listener', $listenerInstance); // Debug message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput( - 'POOL: Listener ' . $listenerInstance->__toString() . + 'DEFAULT-LISTENER-POOL: Listener ' . $listenerInstance->__toString() . + ' with protocol ' . $listenerInstance->getProtocolName() . ' listening to ' . $listenerInstance->getListenAddress() . ':' . $listenerInstance->getListenPort() . ' added to listener pool.' ); diff --git a/application/hub/classes/pools/peer/class_DefaultPeerPool.php b/application/hub/classes/pools/peer/class_DefaultPeerPool.php index 5312daa98..0ab4cee09 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -106,7 +106,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { */ public function addPeer (StorableSocket $socketInstance, $connectionType) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',connectionType=' . $connectionType . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DEFAULT-PEER-POOL: socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',connectionType=' . $connectionType . ' - CALLED!'); // Validate the socket $this->validateSocket($socketInstance); @@ -137,7 +137,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { } // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Adding peer ' . $peerAddress . ':' . $peerPort . ',socketResource=' . $socketInstance->getSocketResource() . ',type=' . $connectionType); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Adding peer ' . $peerAddress . ':' . $peerPort . ',socketResource=' . $socketInstance->getSocketResource() . ',connectionType=' . $connectionType); // Construct the array $socketArray = array( @@ -294,8 +294,8 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { } // END - if } // END - foreach - // Return the determined socket resource - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource()); + // Return the determined socket instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: socketInstance[]=' . gettype($socketInstance)); return $socketInstance; } diff --git a/application/hub/classes/recipient/class_ b/application/hub/classes/recipient/class_ index 82893fec5..e65c6558f 100644 --- a/application/hub/classes/recipient/class_ +++ b/application/hub/classes/recipient/class_ @@ -66,7 +66,7 @@ class ???Recipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance) { // Make sure the recipient is valid - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('!!!-RECIPIENT: recipient=' . $recipient); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('!!!-RECIPIENT: recipient=' . $recipient); assert($recipient == '|||'); $this->partialStub('Please implement this method. recipient=' . $recipient); } diff --git a/application/hub/classes/recipient/dht/class_DhtRecipient.php b/application/hub/classes/recipient/dht/class_DhtRecipient.php index 8d7742ee1..10a2b722b 100644 --- a/application/hub/classes/recipient/dht/class_DhtRecipient.php +++ b/application/hub/classes/recipient/dht/class_DhtRecipient.php @@ -72,7 +72,7 @@ class DhtRecipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance, array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - CALLED!'); // Make sure the recipient is valid assert($recipient == NetworkPackage::NETWORK_TARGET_DHT); @@ -94,12 +94,12 @@ class DhtRecipient extends BaseRecipient implements Recipient { $unl = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS]; // Add it to the list - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: Calling listInstance->addEntry(' . $unl . ') ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: Calling listInstance->addEntry(' . $unl . ') ...'); $listInstance->addEntry('unl', $unl); } // END - foreach // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - EXIT!'); } } diff --git a/application/hub/classes/recipient/direct/class_DirectRecipient.php b/application/hub/classes/recipient/direct/class_DirectRecipient.php index 97155687f..0924696b2 100644 --- a/application/hub/classes/recipient/direct/class_DirectRecipient.php +++ b/application/hub/classes/recipient/direct/class_DirectRecipient.php @@ -69,7 +69,7 @@ class DirectRecipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance, array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DIRECT-RECIPIENT: recipient=' . $recipient); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DIRECT-RECIPIENT: recipient=' . $recipient); // "Explode" all recipients $recipients = explode(NetworkPackage::PACKAGE_RECIPIENT_SEPARATOR, $recipient); diff --git a/application/hub/classes/recipient/self/class_SelfRecipient.php b/application/hub/classes/recipient/self/class_SelfRecipient.php index 25e240619..9601c2b2c 100644 --- a/application/hub/classes/recipient/self/class_SelfRecipient.php +++ b/application/hub/classes/recipient/self/class_SelfRecipient.php @@ -69,7 +69,7 @@ class SelfRecipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance, array $packageData) { // Make sure the recipient is valid - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SELF-RECIPIENT: recipient=' . $recipient); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SELF-RECIPIENT: recipient=' . $recipient); // @TODO Add more checks on data assert($recipient == NetworkPackage::NETWORK_TARGET_SELF); diff --git a/application/hub/classes/recipient/upper/class_UpperRecipient.php b/application/hub/classes/recipient/upper/class_UpperRecipient.php index 3cdc3f446..582d70683 100644 --- a/application/hub/classes/recipient/upper/class_UpperRecipient.php +++ b/application/hub/classes/recipient/upper/class_UpperRecipient.php @@ -69,7 +69,7 @@ class UpperRecipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance, array $packageData) { // Make sure the recipient is valid - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: recipient=' . $recipient); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: recipient=' . $recipient); assert($recipient == NetworkPackage::NETWORK_TARGET_UPPER); // Get all bootstrap nodes diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index 3c526d863..46ef6cfaf 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -84,14 +84,14 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function getSubRegistryKey (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: infoInstance=' . $infoInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: infoInstance=' . $infoInstance->__toString() . ' - CALLED!'); // Get address and port $address = $infoInstance->getAddress(); $port = $infoInstance->getPort(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: address=' . $address . ',port=' . $port); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: address=' . $address . ',port=' . $port); // Get connection type and port number and add both together $key = sprintf('%s:%s:%s:%s', @@ -102,7 +102,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); // Return resulting key return $key; @@ -116,13 +116,13 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function getRegistryKeyFromInfo (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',infoInstance=' . $infoInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',infoInstance=' . $infoInstance->__toString() . ' - CALLED!'); // Get the key $key = $infoInstance->getProtocolName(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); // Return resulting key return $key; @@ -136,7 +136,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function isInfoRegistered (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ' - CALLED!'); // Get the key $key = $this->getRegistryKeyFromInfo($infoInstance); @@ -145,7 +145,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $isRegistered = $this->instanceExists($key); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return result return $isRegistered; @@ -161,7 +161,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function isSocketRegistered (ShareableInfo $infoInstance, StorableSocket $socketInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); // Default is not registered $isRegistered = FALSE; @@ -172,7 +172,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $key = $this->getRegistryKeyFromInfo($infoInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...'); // Get the registry $registryInstance = $this->getInstance($key); @@ -181,12 +181,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketKey = $this->getSubRegistryKey($infoInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...'); // Is it there? if ($registryInstance->instanceExists($socketKey)) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Found instance for socketKey=' . $socketKey . ':' . $registryInstance->getInstance($socketKey)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Found instance for socketKey=' . $socketKey . ':' . $registryInstance->getInstance($socketKey)); // Get the instance $registeredInstance = $registryInstance->getInstance($socketKey); @@ -195,12 +195,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $isRegistered = (($registeredInstance instanceof StorableSocket) && ($registeredInstance->equals($socketInstance))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Final result: isRegistered(' . $socketInstance->getSocketResource() . ')=' . intval($isRegistered)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: Final result: isRegistered(' . $socketInstance->getSocketResource() . ')=' . intval($isRegistered)); } // END - if } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return the result return $isRegistered; @@ -217,7 +217,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!'); // Is the socket already registered? if ($this->isSocketRegistered($infoInstance, $socketInstance)) { @@ -241,7 +241,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketKey = $this->getSubRegistryKey($infoInstance); // We have a sub-registry, the socket key and the socket, now we need to put all together - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: socketKey=' . $socketKey . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - adding socket container instance ...'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: socketKey=' . $socketKey . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - adding socket container instance ...'); $registryInstance->addInstance($socketKey, $socketInstance); // Also register all instances from info instance in socket @@ -257,7 +257,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function getRegisteredSocketResource (Listenable $listenerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getProtocolName() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getProtocolName() . ' - CALLED!'); // The socket must be registered before we can return it if (!$this->isInfoRegistered($listenerInstance)) { @@ -278,7 +278,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketInstance = $registryInstance->getInstance($socketKey); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getProtocolName() . ',socketResource[]=' . gettype($socketInstance) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getProtocolName() . ',socketResource[]=' . gettype($socketInstance) . ' - EXIT!'); // Return the resource return $socketInstance; @@ -298,12 +298,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke // Get all keys and check them foreach ($this->getInstanceRegistry() as $key => $registryInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',registryInstance=' . $registryInstance->__toString()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',registryInstance=' . $registryInstance->__toString()); // This is always a SubRegistry instance foreach ($registryInstance->getInstanceRegistry() as $subKey => $socketInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',socketInstance=' . $socketInstance->__toString()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',socketInstance=' . $socketInstance->__toString()); // Is this a StorableSocket instance and is the address the same? if (($socketInstance instanceof StorableSocket) && ($socketInstance->ifAddressMatches($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]))) { @@ -318,7 +318,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $helperInstance = $socketInstance->getHelperInstance(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',listenerInstance[]=' . gettype($listenerInstance) . ',helperInstance[]=' . gettype($helperInstance)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',listenerInstance[]=' . gettype($listenerInstance) . ',helperInstance[]=' . gettype($helperInstance)); // Is a listener or helper set? if ($listenerInstance instanceof Listenable) { @@ -339,7 +339,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',infoInstance[' . gettype($infoInstance) . ']=' . $infoInstance->__toString() . ' with protocol ' . $infoInstance->getProtocolName() . ' - FOUND!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',infoInstance[' . gettype($infoInstance) . ']=' . $infoInstance->__toString() . ' with protocol ' . $infoInstance->getProtocolName() . ' - FOUND!'); break; } // END - if } // END - foreach diff --git a/application/hub/classes/source/class_BaseUrlSource.php b/application/hub/classes/source/class_BaseUrlSource.php index 9a426a684..74be57889 100644 --- a/application/hub/classes/source/class_BaseUrlSource.php +++ b/application/hub/classes/source/class_BaseUrlSource.php @@ -82,7 +82,7 @@ class BaseUrlSource extends BaseSource { */ protected function enrichCrawlerQueueData (array &$crawlData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : crawlData()=' . count($crawlData) . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : crawlData()=' . count($crawlData) . ' - CALLED!'); // Check for minimum array elements assert(isset($crawlData[self::CRAWL_JOB_ARRAY_START_URL])); @@ -91,7 +91,7 @@ class BaseUrlSource extends BaseSource { // @TODO Add more elements // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -102,13 +102,13 @@ class BaseUrlSource extends BaseSource { */ protected function enqueueInFileStack (array $crawlData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : crawlData()=' . count($crawlData) . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : crawlData()=' . count($crawlData) . ' - CALLED!'); // Get the stack instance and enqueue it $this->getStackInstance()->pushNamed(self::STACKER_NAME_URLS, $crawlData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } } diff --git a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php index 36b772a7c..9ad2f5164 100644 --- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php +++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php @@ -109,7 +109,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R * @return $isFound Whether a CSV file is found */ private function isCsvFileFound () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Is it valid? if (!$this->getDirectoryInstance()->getDirectoryIteratorInstance()->valid()) { @@ -118,16 +118,16 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R } // END - if // Read next entry - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : this->csvFileImported=' . print_r($this->csvFileImported, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : this->csvFileImported=' . print_r($this->csvFileImported, TRUE)); $directoryEntry = $this->getDirectoryInstance()->readDirectoryExcept(array_merge(array('.htaccess', '.', '..'), $this->csvFileImported)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry); // Is it empty or wrong file extension? if ((empty($directoryEntry)) || (substr($directoryEntry, -4, 4) != '.csv')) { // Skip further processing - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - SKIPPED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - SKIPPED!'); return FALSE; } // END - if @@ -135,7 +135,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->lastCsvFileInstance = ObjectFactory::createObjectByConfiguredName('csv_input_file_class', array($this->csvFilePath . '/' . $directoryEntry)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - Instance created - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - Instance created - EXIT!'); // Found an entry return TRUE; @@ -167,7 +167,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function saveCsvDataInCrawlerQueue (array $csvData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData()=' . count($csvData) . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData()=' . count($csvData) . ' - CALLED!'); // The array must have a fixed amount of elements, later enhancements may accept more assert(count($csvData) == self::CRAWL_ENTRY_SIZE); @@ -184,13 +184,13 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvArray()=' . count($csvArray) . ' - BEFORE!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvArray()=' . count($csvArray) . ' - BEFORE!'); // Then add more data to it $this->enrichCrawlerQueueData($csvArray); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvArray()=' . count($csvArray) . ' - AFTER!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvArray()=' . count($csvArray) . ' - AFTER!'); /* * Then enqueue it in the file stack. The local crawler "task" will @@ -199,7 +199,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->enqueueInFileStack($csvArray); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -235,7 +235,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R * @throws NullPointerException If lastCsvFileInstance is not set */ private function addCsvFile () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Is the instance set? if (is_null($this->lastCsvFileInstance)) { @@ -252,7 +252,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R // ... and finally NULL it (to save some RAM) $this->lastCsvFileInstance = NULL; - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -264,7 +264,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function parseCsvFile () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Get next entry $csvFileInstance = $this->getStackSourceInstance()->popNamed(self::STACK_NAME_CSV_FILE); @@ -273,7 +273,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $csvData = $csvFileInstance->readCsvFileLine($this->columnSeparator); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE)); // Expect always an array assert(is_array($csvData)); @@ -281,7 +281,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R // Is the array empty? if (count($csvData) == 0) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : File ' . $csvFileInstance->getFileName() . ' has been fully read.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : File ' . $csvFileInstance->getFileName() . ' has been fully read.'); // Try to close it by actually unsetting (destructing) it unset($csvFileInstance); @@ -303,7 +303,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->getStackSourceInstance()->pushNamed(self::STACK_NAME_CSV_ENTRY, $csvData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -313,13 +313,13 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function parseCsvEntry () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Pop it from stack $csvData = $this->getStackSourceInstance()->popNamed(self::STACK_NAME_CSV_ENTRY); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : csvData[' . gettype($csvData) . ']=' . print_r($csvData, TRUE)); // It must have a fixed amount of elements (see method parseCsvFile() for details) assert(count($csvData) == self::CRAWL_ENTRY_SIZE); @@ -328,7 +328,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->saveCsvDataInCrawlerQueue($csvData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -371,7 +371,5 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->partialStub('Please implement this method.'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/communicator/class_Communicator b/application/hub/classes/states/communicator/class_Communicator index 04406a0cd..8f05ca6b1 100644 --- a/application/hub/classes/states/communicator/class_Communicator +++ b/application/hub/classes/states/communicator/class_Communicator @@ -52,7 +52,7 @@ class Communicator???State extends BaseCommunicatorState implements Stateable { $stateInstance = new Communicator???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Set the communicator instance $stateInstance->setCommunicatorInstance($communicatorInstance); @@ -60,7 +60,5 @@ class Communicator???State extends BaseCommunicatorState implements Stateable { // Return the prepared instance return $stateInstance; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/crawler/class_Crawler b/application/hub/classes/states/crawler/class_Crawler index 34f86784b..e03a60c76 100644 --- a/application/hub/classes/states/crawler/class_Crawler +++ b/application/hub/classes/states/crawler/class_Crawler @@ -52,7 +52,7 @@ class Crawler???State extends BaseCrawlerState implements Stateable { $stateInstance = new Crawler???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE: Has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Set the crawler instance $stateInstance->setCrawlerInstance($crawlerInstance); @@ -60,7 +60,5 @@ class Crawler???State extends BaseCrawlerState implements Stateable { // Return the prepared instance return $stateInstance; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/cruncher/class_Cruncher b/application/hub/classes/states/cruncher/class_Cruncher index d4f17b46f..33b6e167b 100644 --- a/application/hub/classes/states/cruncher/class_Cruncher +++ b/application/hub/classes/states/cruncher/class_Cruncher @@ -52,7 +52,7 @@ class Cruncher???State extends BaseCruncherState implements Stateable { $stateInstance = new Cruncher???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-STATE: Has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-STATE: Has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Set the cruncher instance $stateInstance->setCruncherInstance($cruncherInstance); @@ -70,7 +70,5 @@ class Cruncher???State extends BaseCruncherState implements Stateable { public function executeState (Executor $executorInstance) { $this->partialStub('This state needs implementation. executorInstance=' . $executorInstance->__toString()); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/dht/active/class_DhtActiveState.php b/application/hub/classes/states/dht/active/class_DhtActiveState.php index 18021357f..9e908d6b9 100644 --- a/application/hub/classes/states/dht/active/class_DhtActiveState.php +++ b/application/hub/classes/states/dht/active/class_DhtActiveState.php @@ -55,7 +55,7 @@ class DhtActiveState extends BaseDhtState implements Stateable { $stateInstance = new DhtActiveState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Return the prepared instance return $stateInstance; diff --git a/application/hub/classes/states/dht/booting/class_DhtBootingState.php b/application/hub/classes/states/dht/booting/class_DhtBootingState.php index 1059659cf..e03a97a8c 100644 --- a/application/hub/classes/states/dht/booting/class_DhtBootingState.php +++ b/application/hub/classes/states/dht/booting/class_DhtBootingState.php @@ -58,7 +58,7 @@ class DhtBootingState extends BaseDhtState implements Stateable { $stateInstance = new DhtBootingState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Get node instance and enable DHT bootstrap requests NodeObjectFactory::createNodeInstance()->enableAcceptDhtBootstrap(); diff --git a/application/hub/classes/states/dht/class_Dht b/application/hub/classes/states/dht/class_Dht index 974d6f0c7..71aea4b48 100644 --- a/application/hub/classes/states/dht/class_Dht +++ b/application/hub/classes/states/dht/class_Dht @@ -55,7 +55,7 @@ class Dht???State extends BaseDhtState implements Stateable { $stateInstance = new Dht???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Return the prepared instance return $stateInstance; diff --git a/application/hub/classes/states/dht/init/class_DhtInitState.php b/application/hub/classes/states/dht/init/class_DhtInitState.php index 107821756..da7808747 100644 --- a/application/hub/classes/states/dht/init/class_DhtInitState.php +++ b/application/hub/classes/states/dht/init/class_DhtInitState.php @@ -57,7 +57,7 @@ class DhtInitState extends BaseDhtState implements Stateable { $stateInstance = new DhtInitState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Return the prepared instance return $stateInstance; diff --git a/application/hub/classes/states/dht/virgin/class_DhtVirginState.php b/application/hub/classes/states/dht/virgin/class_DhtVirginState.php index a80a70e82..8ddde7795 100644 --- a/application/hub/classes/states/dht/virgin/class_DhtVirginState.php +++ b/application/hub/classes/states/dht/virgin/class_DhtVirginState.php @@ -57,7 +57,7 @@ class DhtVirginState extends BaseDhtState implements Stateable { $stateInstance = new DhtVirginState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE: Has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Return the prepared instance return $stateInstance; diff --git a/application/hub/classes/states/miner/booting/class_MinerBootingState.php b/application/hub/classes/states/miner/booting/class_MinerBootingState.php index c0b037579..4bc9d534e 100644 --- a/application/hub/classes/states/miner/booting/class_MinerBootingState.php +++ b/application/hub/classes/states/miner/booting/class_MinerBootingState.php @@ -56,7 +56,7 @@ class MinerBootingState extends BaseMinerState implements Stateable { $stateInstance = new MinerBootingState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE: Has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE: Has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Return the prepared instance return $stateInstance; @@ -84,7 +84,5 @@ class MinerBootingState extends BaseMinerState implements Stateable { // Mark producer as booted $this->bootedProducer[$executorInstance->__toString()] = TRUE; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/miner/class_Miner b/application/hub/classes/states/miner/class_Miner index 4db5144a1..46b121ffc 100644 --- a/application/hub/classes/states/miner/class_Miner +++ b/application/hub/classes/states/miner/class_Miner @@ -52,7 +52,7 @@ class Miner???State extends BaseMinerState implements Stateable { $stateInstance = new Miner???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE: Has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE: Has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Set the miner instance $stateInstance->setMinerInstance($minerInstance); @@ -70,7 +70,5 @@ class Miner???State extends BaseMinerState implements Stateable { public function executeState (Executor $executorInstance) { $this->partialStub('This state needs implementation. executorInstance=' . $executorInstance->__toString()); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/states/node/class_Node b/application/hub/classes/states/node/class_Node index cb2d40003..51c034474 100644 --- a/application/hub/classes/states/node/class_Node +++ b/application/hub/classes/states/node/class_Node @@ -55,7 +55,7 @@ class Node???State extends BaseNodeState implements Stateable { $stateInstance = new Node???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-STATE: Has changed from ' . $nodeInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-STATE: Has changed from ' . $nodeInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Set the node instance $stateInstance->setNodeInstance($nodeInstance); @@ -63,7 +63,5 @@ class Node???State extends BaseNodeState implements Stateable { // Return the prepared instance return $stateInstance; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php b/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php index 285458ea1..d24f16cbb 100644 --- a/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php +++ b/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php @@ -65,7 +65,7 @@ class ConnectionStatisticsHelper extends BaseHubSystem { * @return $isExhausted Whether the retry count has been reached */ public static function isConnectRetryExhausted (ConnectionHelper $helperInstance) { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - CALLED!'); // Construct config entry $configEntry = $helperInstance->getProtocolName() . '_connect_retry_max'; @@ -79,7 +79,7 @@ class ConnectionStatisticsHelper extends BaseHubSystem { ); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ',isExhausted=' . intval($isExhausted) . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ',isExhausted=' . intval($isExhausted) . ' - EXIT!'); return $isExhausted; } @@ -90,15 +90,15 @@ class ConnectionStatisticsHelper extends BaseHubSystem { * @return void */ public static function increaseConnectRetry (ConnectionHelper $helperInstance) { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - CALLED!'); // Is the counter there if (!isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])) { // First attempt - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - FIRST!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - FIRST!'); self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] = 1; } else { // Next attempt - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - INCREMENT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-STATISTICS: helperInstance=' . $helperInstance->__toString() . ' - INCREMENT!'); self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count']++; } diff --git a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php index 27d937c84..6774f624c 100644 --- a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php +++ b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php @@ -72,7 +72,7 @@ class RawDataInputStream extends BaseStream implements InputStream { */ public function streamData ($data) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM[' . __METHOD__ . ':' . __LINE__ . ': data(' . strlen($data) . ')=' . $data); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM: data(' . strlen($data) . ')=' . $data . ' - CALLED!'); // Do we have start and end marker again? assert($this->ifStartEndMarkersSet($data)); @@ -102,12 +102,10 @@ class RawDataInputStream extends BaseStream implements InputStream { } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM: Length of data is now ' . strlen($data) . ' Bytes.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-INPUT-STREAM: Length of data is now ' . strlen($data) . ' Bytes.'); // Return it return $data; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php index c6c4b2b82..4eccc7ae5 100644 --- a/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php +++ b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php @@ -68,14 +68,12 @@ class RawDataOutputStream extends BaseStream implements OutputStream { * [[S]] - Start marker * [[E]] - End marker */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data()=' . strlen($data) . ' - BEFORE!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data()=' . strlen($data) . ' - BEFORE!'); $data = BaseRawDataHandler::STREAM_START_MARKER . base64_encode($data) . BaseRawDataHandler::STREAM_END_MARKER; - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data(' . strlen($data) . ')=' . $data); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data(' . strlen($data) . ')=' . $data); // Return it return $data; } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tags/package/class_PackageTags.php b/application/hub/classes/tags/package/class_PackageTags.php index b2d24d840..defb26b22 100644 --- a/application/hub/classes/tags/package/class_PackageTags.php +++ b/application/hub/classes/tags/package/class_PackageTags.php @@ -114,7 +114,7 @@ class PackageTags extends BaseTag implements Tagable { */ private function extractTagsFromPackageData (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: packageData=' . print_r($packageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: packageData=' . print_r($packageData, TRUE)); /* * We take a look at the tags (in most cases only one is needed) so diff --git a/application/hub/classes/tasks/apt-proxy/class_ b/application/hub/classes/tasks/apt-proxy/class_ index 011822d47..b11ac8fef 100644 --- a/application/hub/classes/tasks/apt-proxy/class_ +++ b/application/hub/classes/tasks/apt-proxy/class_ @@ -83,9 +83,7 @@ class AptProxy???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('APT-PROXY-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php index 0b050b803..1fa8b3034 100644 --- a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php +++ b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php @@ -82,9 +82,7 @@ class AptProxyListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('APT-PROXY-LISTENER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/chat/class_ b/application/hub/classes/tasks/chat/class_ index b3a186942..95200985b 100644 --- a/application/hub/classes/tasks/chat/class_ +++ b/application/hub/classes/tasks/chat/class_ @@ -83,9 +83,7 @@ class Chat???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHAT-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php b/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php index e415e301d..cecc84acb 100644 --- a/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php +++ b/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php @@ -82,9 +82,7 @@ class ChatTelnetListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHAT-TELNET-LISTENER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/class_Crawler b/application/hub/classes/tasks/crawler/class_Crawler index 92500cd17..c7384fbcf 100644 --- a/application/hub/classes/tasks/crawler/class_Crawler +++ b/application/hub/classes/tasks/crawler/class_Crawler @@ -83,9 +83,7 @@ class Crawler???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php index 12b86c2b4..b49ecc748 100644 --- a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php +++ b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php @@ -80,7 +80,7 @@ class CrawlerNodeCommunicatorTask extends BaseTask implements Taskable, Visitabl $stateInstance = Registry::getRegistry()->getInstance('crawler')->getStateInstance(); // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-NODE-COMMUNICATOR-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our communicator instance for generating some test units $stateInstance->executeState($communicatorInstance); @@ -93,7 +93,7 @@ class CrawlerNodeCommunicatorTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-NODE-COMMUNICATOR-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php b/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php index 21f50facd..5d1d2ea2e 100644 --- a/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php +++ b/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php @@ -83,9 +83,7 @@ class CrawlerDocumentParserTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-DOCUMENT-PARSER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php b/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php index d08064d67..1c0e1f86a 100644 --- a/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php +++ b/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php @@ -83,9 +83,7 @@ class CrawlerMimeSnifferTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-MIME-SNIFFER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php b/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php index 3785b5c2a..bc22789d8 100644 --- a/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php +++ b/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php @@ -83,9 +83,7 @@ class CrawlerPingTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-PING-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php b/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php index 342d5c0c2..7bbd554b0 100644 --- a/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php +++ b/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php @@ -83,9 +83,7 @@ class CrawlerRemoteJobPublisherTask extends BaseTask implements Taskable, Visita * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-REMOTE-JOB-PUBLISHER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/scanner/class_Crawler b/application/hub/classes/tasks/crawler/scanner/class_Crawler index d47394f4a..6c7763f6d 100644 --- a/application/hub/classes/tasks/crawler/scanner/class_Crawler +++ b/application/hub/classes/tasks/crawler/scanner/class_Crawler @@ -83,9 +83,7 @@ class Crawler???ScannerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/scanner/uploaded_list/class_CrawlerUploadedListScannerTask.php b/application/hub/classes/tasks/crawler/scanner/uploaded_list/class_CrawlerUploadedListScannerTask.php index 581e2da31..8e6b59aad 100644 --- a/application/hub/classes/tasks/crawler/scanner/uploaded_list/class_CrawlerUploadedListScannerTask.php +++ b/application/hub/classes/tasks/crawler/scanner/uploaded_list/class_CrawlerUploadedListScannerTask.php @@ -86,9 +86,7 @@ class CrawlerUploadedListScannerTask extends BaseTask implements Taskable, Visit * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-SCANNER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php b/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php index 1b1b51731..4e60fd5ae 100644 --- a/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php +++ b/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php @@ -83,9 +83,7 @@ class CrawlerSnippetExtractorTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SNIPPET-EXTRACTOR-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php b/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php index 2d0cab988..7d91182f9 100644 --- a/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php +++ b/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php @@ -83,9 +83,7 @@ class CrawlerStructureAnalyzerTask extends BaseTask implements Taskable, Visitab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-STRUCTURE-ANALYZER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_crawler/local/class_CrawlerLocalUrlCrawlerTask.php b/application/hub/classes/tasks/crawler/url_crawler/local/class_CrawlerLocalUrlCrawlerTask.php index 9ef774d79..23c981f4f 100644 --- a/application/hub/classes/tasks/crawler/url_crawler/local/class_CrawlerLocalUrlCrawlerTask.php +++ b/application/hub/classes/tasks/crawler/url_crawler/local/class_CrawlerLocalUrlCrawlerTask.php @@ -83,9 +83,7 @@ class CrawlerLocalUrlCrawlerTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-LOCAL-URL-CRAWLER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_crawler/remote/class_CrawlerRemoteUrlCrawlerTask.php b/application/hub/classes/tasks/crawler/url_crawler/remote/class_CrawlerRemoteUrlCrawlerTask.php index 0a0ea736b..9712af216 100644 --- a/application/hub/classes/tasks/crawler/url_crawler/remote/class_CrawlerRemoteUrlCrawlerTask.php +++ b/application/hub/classes/tasks/crawler/url_crawler/remote/class_CrawlerRemoteUrlCrawlerTask.php @@ -83,9 +83,7 @@ class CrawlerRemoteUrlCrawlerTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-REMOTE-URL-CRAWLER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource index c038eac31..4c478cc3b 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource @@ -94,9 +94,7 @@ class CrawlerUrlSource???Task extends BaseUrlSourceTask implements Taskable, Vis * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php index beda4f4b4..864cc18a3 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php @@ -94,9 +94,7 @@ class CrawlerUrlSourceFoundRssTask extends BaseUrlSourceTask implements Taskable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-FOUND-RSS-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php index ea52e9b1e..0e3f9c4e6 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php @@ -94,9 +94,7 @@ class CrawlerUrlSourceLocalStartTask extends BaseUrlSourceTask implements Taskab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-LOCAL-START-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php index 2155c75e7..8add51389 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php @@ -94,9 +94,7 @@ class CrawlerUrlSourceRssStartTask extends BaseUrlSourceTask implements Taskable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-RSS-START-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php index d1ddc638f..85fea288d 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php @@ -94,9 +94,7 @@ class CrawlerUrlSourceUploadedListTask extends BaseUrlSourceTask implements Task * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-URL-SOURCE-UPLOADED-LIST-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/cruncher/class_Cruncher b/application/hub/classes/tasks/cruncher/class_Cruncher index a8811be40..882933389 100644 --- a/application/hub/classes/tasks/cruncher/class_Cruncher +++ b/application/hub/classes/tasks/cruncher/class_Cruncher @@ -83,9 +83,7 @@ class Cruncher???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php b/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php index b7536bfd3..b0ec5ee2c 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php @@ -78,7 +78,7 @@ class CruncherKeyProducerTask extends BaseTask implements Taskable, Visitable { $stateInstance = Registry::getRegistry()->getInstance('cruncher')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-KEY-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our producer instance for generating some test units $stateInstance->executeState($producerInstance); @@ -91,9 +91,7 @@ class CruncherKeyProducerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-KEY-PRODUCER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php b/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php index 892fd7609..2b08ed3e0 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php @@ -78,7 +78,7 @@ class CruncherTestUnitProducerTask extends BaseTask implements Taskable, Visitab $stateInstance = Registry::getRegistry()->getInstance('cruncher')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-TEST-UNIT-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our producer instance for generating some test units $stateInstance->executeState($producerInstance); @@ -91,9 +91,7 @@ class CruncherTestUnitProducerTask extends BaseTask implements Taskable, Visitab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-TEST-UNIT-PRODUCER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php b/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php index 1612c4a5c..15a306cf0 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php @@ -92,9 +92,7 @@ class CruncherWorkUnitFetcherTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-WORK-UNIT-FETCHER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php b/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php index 1c5a9d0a1..b6c6d9c33 100644 --- a/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php +++ b/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php @@ -92,9 +92,7 @@ class MinerBlockFetcherTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-BLOCK-FETCHER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php b/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php index 0c38c8d46..bc6ed58de 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php @@ -79,7 +79,7 @@ class MinerRealGenesisBlockProducerTask extends BaseTask implements Taskable, Vi $stateInstance = Registry::getRegistry()->getInstance('miner')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-GENESIS-BLOCK-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our producer instance for generating some test units $stateInstance->executeState($producerInstance); @@ -92,9 +92,7 @@ class MinerRealGenesisBlockProducerTask extends BaseTask implements Taskable, Vi * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-GENESIS-BLOCK-PRODUCER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php b/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php index 7c47c875a..c1ff8f3d7 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php @@ -78,7 +78,7 @@ class MinerTestGenesisBlockProducerTask extends BaseTask implements Taskable, Vi $stateInstance = Registry::getRegistry()->getInstance('miner')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-TEST-GENESIS-BLOCK-PRODUCER-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our producer instance for generating some test units $stateInstance->executeState($producerInstance); @@ -91,9 +91,7 @@ class MinerTestGenesisBlockProducerTask extends BaseTask implements Taskable, Vi * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-TEST-GENESIS-BLOCK-PRODUCER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/miner/class_Miner b/application/hub/classes/tasks/miner/class_Miner index 577d8f6ff..57d413d08 100644 --- a/application/hub/classes/tasks/miner/class_Miner +++ b/application/hub/classes/tasks/miner/class_Miner @@ -83,9 +83,7 @@ class Miner???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php b/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php index 2e9aedaf2..a89138a43 100644 --- a/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php +++ b/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php @@ -79,7 +79,7 @@ class MinerNodeCommunicatorTask extends BaseTask implements Taskable, Visitable $stateInstance = $communicatorInstance->getStateInstance(); // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-NODE-COMMUNICATOR-TASK: Executing stateInstance=' . $stateInstance->__toString()); // We can now invoke that state instance and pass our communicator instance for generating some test units $stateInstance->executeState($communicatorInstance); @@ -92,7 +92,7 @@ class MinerNodeCommunicatorTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-NODE-COMMUNICATOR-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/network/class_NetworkPackage b/application/hub/classes/tasks/network/class_NetworkPackage index 4bf0f6e88..99e20b28e 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackage +++ b/application/hub/classes/tasks/network/class_NetworkPackage @@ -83,9 +83,7 @@ class NetworkPackage???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php index 8d850d6df..9073efe36 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php +++ b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php @@ -65,8 +65,14 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { * @todo Also visit some sub-objects? */ public function accept (Visitor $visitorInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-READER-TASK: visitorInstance=%s - CALLED!', $visitorInstance->__toString())); + // Visit this task $visitorInstance->visitTask($this); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: EXIT!'); } /** @@ -75,11 +81,17 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { * @return void */ public function executeTask () { - // "Cache" package instance + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: CALLED!'); + + // Get package instance $packageInstance = NetworkPackageFactory::createNetworkPackageInstance(); // Do we have something to handle? if ($packageInstance->isProcessedMessagePending()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->handleProcessedMessage() ...'); + /* * A previously proccessed message is waiting for being * "interpreted". This is done by trying to find a configuration @@ -87,6 +99,9 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { */ $packageInstance->handleProcessedMessage(); } elseif ($packageInstance->isNewMessageArrived()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->handleNewlyArrivedMessage() ...'); + /* * A fully "decoded" message has been received and added for being * processed. Processing a message should not take long, so mostly @@ -96,6 +111,9 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { */ $packageInstance->handleNewlyArrivedMessage(); } elseif ($packageInstance->isIncomingRawDataHandled()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->assembleDecodedDataToPackage() ...'); + /* * Incoming decoded data has been handled (see below) so it needs to * be assembled back to a "package array". Please see NetworkPackage @@ -103,17 +121,29 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { */ $packageInstance->assembleDecodedDataToPackage(); } elseif ($packageInstance->ifMultipleMessagesPending()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->handleMultipleMessages() ...'); + /* * Some raw data contained multiple messages which where now splitted. */ $packageInstance->handleMultipleMessages(); } elseif ($packageInstance->isNewRawDataPending()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->handleIncomingDecodedData() ...'); + // Raw, decoded data has been received $packageInstance->handleIncomingDecodedData(); } elseif ($packageInstance->ifAssemblerHasPendingDataLeft()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Calling packageInstance->handleAssemblerPendingData() ...'); + // Handle any pending data from the package assembler $packageInstance->handleAssemblerPendingData(); - } // END - if + } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: EXIT!'); } /** @@ -123,7 +153,7 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-READER-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php b/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php index dc1c5220b..d9609e6d2 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php +++ b/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php @@ -65,8 +65,14 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable { * @todo Also visit some sub-objects? */ public function accept (Visitor $visitorInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-WRITER-TASK: visitorInstance=%s - CALLED!', $visitorInstance->__toString())); + // Visit this task $visitorInstance->visitTask($this); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!'); } /** @@ -75,23 +81,41 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable { * @return void */ public function executeTask () { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: CALLED!'); + // "Cache" package instance $packageInstance = NetworkPackageFactory::createNetworkPackageInstance(); // Do we have something to deliver? if ($packageInstance->isEncodedDataPending()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendEncodedData() ...'); + // Sent encoded (raw) data $packageInstance->sendEncodedData(); } elseif ($packageInstance->isPackageWaitingForDelivery()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->sendWaitingPackage() ...'); + // Sent it finally out $packageInstance->sendWaitingPackage(); } elseif ($packageInstance->isPackageDeclared()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->processDeclaredPackage() ...'); + // Prepare package for delivery $packageInstance->processDeclaredPackage(); } elseif ($packageInstance->isPackageEnqueued()) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Calling packageInstance->declareEnqueuedPackage() ...'); + // Okay, then deliver (better discover its recipients) this package $packageInstance->declareEnqueuedPackage(); } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: EXIT!'); } /** @@ -101,7 +125,7 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-WRITER-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php b/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php index de74d8cee..b83eca7ac 100644 --- a/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php +++ b/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php @@ -85,9 +85,7 @@ class NodeAnnouncementTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-ANNOUNCEMENT-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php b/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php index 9f896b593..556e032b2 100644 --- a/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php +++ b/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php @@ -120,9 +120,7 @@ class NodeChunkAssemblerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-CHUNK-ASSEMBLER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/class_Node b/application/hub/classes/tasks/node/class_Node index 1cfd8566c..ca0ddc381 100644 --- a/application/hub/classes/tasks/node/class_Node +++ b/application/hub/classes/tasks/node/class_Node @@ -83,9 +83,7 @@ class Node???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php b/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php index bcbaa6195..a570de132 100644 --- a/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php +++ b/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php @@ -94,9 +94,7 @@ class NodePackageDecoderTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-DECODER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/dht/class_NodeDht b/application/hub/classes/tasks/node/dht/class_NodeDht index fac682a0d..6f642a28e 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDht +++ b/application/hub/classes/tasks/node/dht/class_NodeDht @@ -83,9 +83,7 @@ class NodeDht???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-|||-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php index c2465718d..c00f05218 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php @@ -85,7 +85,7 @@ class NodeDhtBootstrapTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-BOOTSTRAP-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php index e9c0df869..ffac95957 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php @@ -85,7 +85,7 @@ class NodeDhtInitializationTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-INITIALIZATION-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php index 625e8e532..92aeffe58 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php @@ -85,7 +85,7 @@ class NodeDhtLateBootstrapTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-LATE-BOOTSTRAP-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php index 01bbf446d..babedfe6f 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php @@ -92,7 +92,7 @@ class NodeDhtPublicationCheckTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PUBLICATION-CHECK-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php index 268df7827..d25f6dcba 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php @@ -92,7 +92,7 @@ class NodeDhtPublicationTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-PUBLICATION-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php index cd9ddadac..34c11cf06 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php @@ -92,7 +92,7 @@ class NodeDhtQueryTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-QUERY-TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php b/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php index 2fe9803cb..b5eb564c0 100644 --- a/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php +++ b/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php @@ -68,7 +68,7 @@ class NodeSocketListenerTask extends BaseTask implements Taskable, Visitable { $nodeInstance = NodeObjectFactory::createNodeInstance(); // Visit the pool listener task - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-TASK: Going to visit object ' . $nodeInstance->getListenerPoolInstance()->__toString() . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('LISTENER-TASK: Going to visit object ' . $nodeInstance->getListenerPoolInstance()->__toString() . ' ...'); $nodeInstance->getListenerPoolInstance()->accept($visitorInstance); // Visit this task @@ -92,9 +92,7 @@ class NodeSocketListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-SOCKET-LISTENER-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/ping/class_NodePingTask.php b/application/hub/classes/tasks/node/ping/class_NodePingTask.php index 3688dde7e..f2fc8c5f6 100644 --- a/application/hub/classes/tasks/node/ping/class_NodePingTask.php +++ b/application/hub/classes/tasks/node/ping/class_NodePingTask.php @@ -94,9 +94,7 @@ class NodePingTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PING-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php b/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php index 0a979eefb..700654dc6 100644 --- a/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php +++ b/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php @@ -85,9 +85,7 @@ class NodeSelfConnectTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-SELF-CONNECTTASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php b/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php index 2a54b5aa6..8aaa8f045 100644 --- a/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php +++ b/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php @@ -86,9 +86,7 @@ class NodePackageTagsInitTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-PACKAGE-TAGS-INIT-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php b/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php index 40040e0fe..dd5489057 100644 --- a/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php +++ b/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php @@ -82,9 +82,7 @@ class NodeUpdateCheckTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-UPDATE-CHECK-TASK: Shutting down...'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/tools/class_HubTools.php b/application/hub/classes/tools/class_HubTools.php index 011ee3271..ab791df49 100644 --- a/application/hub/classes/tools/class_HubTools.php +++ b/application/hub/classes/tools/class_HubTools.php @@ -241,31 +241,31 @@ class HubTools extends BaseHubSystem { */ public static function determineOwnInternalAddress () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is the internal_address config entry set? if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_address') == 'N') { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineOwnExternalAddress() as allow_publish_internal_address=N is set ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineOwnExternalAddress() as allow_publish_internal_address=N is set ...'); // Not allowed to publish internal address, so use external $unl = self::determineOwnExternalAddress(); } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address') != '') { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Getting config entry internal_address ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Getting config entry internal_address ...'); // Use it as internal address $unl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address'); } else { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineInternalUniversalNodeLocator() ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Calling self::determineInternalUniversalNodeLocator() ...'); // Determine own internal address $unl = self::determineInternalUniversalNodeLocator(); } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $unl . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $unl . ' - EXIT!'); // Return it return $unl; @@ -278,7 +278,7 @@ class HubTools extends BaseHubSystem { */ public static function determineInternalUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is there cache? (This shortens a lot calls) if (!isset($GLOBALS[__METHOD__])) { @@ -295,7 +295,7 @@ class HubTools extends BaseHubSystem { } // END - if // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); return $GLOBALS[__METHOD__]; } @@ -306,7 +306,7 @@ class HubTools extends BaseHubSystem { */ public static function determineExternalUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is there cache? (This shortens a lot calls) if (!isset($GLOBALS[__METHOD__])) { @@ -323,7 +323,7 @@ class HubTools extends BaseHubSystem { } // END - if // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); return $GLOBALS[__METHOD__]; } diff --git a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index e6609bf14..38c50eb18 100644 --- a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -72,7 +72,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List */ public function visitPool (Poolable $poolInstance) { // A pool doesn't normally have any raw data waiting - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: poolInstance=' . $poolInstance->__toString() . ' - CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: poolInstance=' . $poolInstance->__toString() . ' - CALLED!'); } /** @@ -87,7 +87,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List * traffic. This is why its method monitorIncomingRawData() is not * called. */ - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); } /** @@ -98,11 +98,9 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List */ public function visitDecorator (BaseDecorator $decoratorInstance) { // Do monitor here - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting ' . $listenerInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - CALLED!'); $decoratorInstance->monitorIncomingRawData(); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting ' . $listenerInstance->__toString() . ' - FINISH'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAWDATA-MONITOR-VISITOR: Visiting decoratorInstance=' . $decoratorInstance->__toString() . ' - FINISH'); } -} -// [EOF] -?> +} diff --git a/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php b/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php index fab8b1bb5..cd1802a17 100644 --- a/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php +++ b/application/hub/classes/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php @@ -67,13 +67,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitPool (Poolable $poolInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $poolInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $poolInstance->__toString() . ' - CALLED!'); // Pre-shutdown the pool $poolInstance->preShutdown(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $poolInstance->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $poolInstance->__toString() . ' - EXIT!'); } /** @@ -84,13 +84,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitDecorator (Listenable $decoratorInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $decoratorInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - CALLED!'); // Pre-shutdown the pool $decoratorInstance->doShutdown(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $decoratorInstance->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - EXIT!'); } /** @@ -101,13 +101,13 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { */ public function visitListener (Listenable $listenerInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $listenerInstance->__toString() . ' - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $listenerInstance->__toString() . ' - CALLED!'); // Pre-shutdown the pool $listenerInstance->doShutdown(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visit of ' . $listenerInstance->__toString() . ' - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SHUTDOWN-LISTENER-POOL-VISITOR: Visit of ' . $listenerInstance->__toString() . ' - EXIT!'); } } diff --git a/application/hub/classes/visitor/tasks/class_ActiveTaskVisitor.php b/application/hub/classes/visitor/tasks/class_ActiveTaskVisitor.php index 4ab5664c0..d615b6944 100644 --- a/application/hub/classes/visitor/tasks/class_ActiveTaskVisitor.php +++ b/application/hub/classes/visitor/tasks/class_ActiveTaskVisitor.php @@ -72,9 +72,9 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, PoolVisitor, */ public function visitTask (Taskable $taskInstance) { // Execute the task from this visitor - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting task ' . $taskInstance->__toString() . ' - CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting task ' . $taskInstance->__toString() . ' - CALLED!'); $taskInstance->executeTask(); - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting task ' . $taskInstance->__toString() . ' - EXIT!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting task ' . $taskInstance->__toString() . ' - EXIT!'); } /** @@ -99,9 +99,9 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, PoolVisitor, */ public function visitListener (Listenable $listenerInstance) { // Do "listen" here - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting ' . $listenerInstance->__toString() . ' - CALLED!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); $listenerInstance->doListen(); - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ' ]: Visiting ' . $listenerInstance->__toString() . ' - FINISH'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ACTIVE-TASK-VISITOR: Visiting listenerInstance=' . $listenerInstance->__toString() . ' - FINISH'); } /** diff --git a/application/hub/config.php b/application/hub/config.php index 391824b0e..ad4c2a7e2 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -881,7 +881,7 @@ $cfg->setConfigEntry('peer_init_state_class', 'Hub\State\Peer\InitPeerState'); $cfg->setConfigEntry('peer_connected_state_class', 'Hub\State\Peer\ConnectedPeerState'); // CFG: PEER-PROBLEM-STATE-CLASS -$cfg->setConfigEntry('peer_problem_state_class', 'Hub\State\Peer;\ProblemPeerState'); +$cfg->setConfigEntry('peer_problem_state_class', 'Hub\State\Peer\ProblemPeerState'); // CFG: PEER-CONNECTION-REFUSED-STATE-CLASS $cfg->setConfigEntry('peer_connection_refused_state_class', 'Hub\State\Peer\ConnectionRefusedPeerState'); diff --git a/core b/core index dc46df7fb..0a6b81dde 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit dc46df7fb4a0358cb7554c33b6f08d9ff8418c66 +Subproject commit 0a6b81dde16619b6d4466cca1ff8ad52226e9384 -- 2.39.5