From: Roland Häder Date: Fri, 19 May 2017 22:11:13 +0000 (+0200) Subject: Next wave of rewrite: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6b0b553e124bf498dea02289ab70d74e4e87fd2f;p=hub.git Next wave of rewrite: - rewrote addPeer() signature to StorableSocket - removed logging of calling method/line, will be done later otherwise - some logging added - implemented isValidSocket() Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index 09f927df2..ed5b20517 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -145,6 +145,9 @@ class BaseHubSystem extends BaseFrameworkSystem { * @todo Move all this socket-related stuff into own class, most of it resides in BaseListener */ protected final function handleSocketError ($method, $line, StorableSocket $socketInstance, array $socketData) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-SYSTEM: CALLED!'); + // This method handles only socket resources if (!$socketInstance->isValidSocket()) { // No resource, abort here diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index 0b0165d09..051f56f09 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -63,7 +63,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable unset($packageData[NetworkPackage::PACKAGE_DATA_HASH]); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']:socketResource=' . $socketResource . ',packageData='.print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER:socketResource=' . $socketResource . ',packageData='.print_r($packageData, true)); // Is the info instance set? if ($infoInstance instanceof ShareableInfo) { @@ -72,18 +72,18 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable $helperInstance = $infoInstance->getHelperInstance(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: listenerInstance[]=' . gettype($listenerInstance)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER: listenerInstance[]=' . gettype($listenerInstance)); // Is there a listener instance set? if ($listenerInstance instanceof Listenable) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: Setting listenerInstance=' . $listenerInstance->__toString() . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER: Setting listenerInstance=' . $listenerInstance->__toString() . ' ...'); // Set it here for later usage $containerInstance->setListenerInstance($listenerInstance); } elseif ($helperInstance instanceof ConnectionHelper) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: Setting helperInstance=' . $helperInstance->__toString() . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER: Setting helperInstance=' . $helperInstance->__toString() . ' ...'); // Set it here for later usage $containerInstance->setHelperInstance($helperInstance); @@ -111,7 +111,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable $packageData = $this->getPackageData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',packageData=' . print_r($packageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER: unl=' . $unl . ',packageData=' . print_r($packageData, true)); // So, does both match? $matches = ((isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) && ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] === $unl)); @@ -128,7 +128,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ public function ifSocketResourceMatches ($socketResource) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER[' . __METHOD__ . ':' . __LINE__ . ']: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-CONTAINER: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource()); // So, does both match? $matches = ((is_resource($socketResource)) && ($socketResource === $this->getSocketResource())); @@ -143,6 +143,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable * @return $isServerSocket Whether the stored socket resource is a server socket */ public function isServerSocketResource () { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET: Testing if server socket - CALLED!'); + // Check it $isServerSocket = (($this->isValidSocket()) && ($this->getSocketPeerName() === FALSE)); @@ -156,6 +159,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable // Check peer name, it must be empty $isServerSocket = (($isServerSocket) && (empty($peerName))); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET: isServerSocket=%d - EXIT!', intval($isServerSocket))); + // Return result return $isServerSocket; } @@ -208,13 +214,30 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable */ public function accept (Visitor $visitorInstance) { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-SOCKET[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!'); // Visit this listener $visitorInstance->visitListener($this); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-SOCKET[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + } + + /** + * Validates stored stocket + * + * @return $isValidSocket Whether the stored socket is valid + */ + public function isValidSocket () { + // Get socket resource + $socketResource = $this->getSocketResource(); + + // Is it valid? + // @TODO maybe add more checks? is_resource() is still to less + $isValidSocket = (is_resource($socketResource)); + + // Return status + return $isValidSocket; } } diff --git a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php index 772fe05d3..ab17c3e81 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 BaseDatabaseWrapper implem */ private function prepareSearchInstance (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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 BaseDatabaseWrapper implem $searchInstance->setLimit(1); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $searchInstance; @@ -159,7 +159,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ private function prepareLocalDataSetInstance () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get node/request instances $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -198,7 +198,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $dataSetInstance->addCriteria(self::DB_COLUMN_ACCEPT_BOOTSTRAP, $this->translateBooleanToYesNo($nodeInstance->isAcceptingDhtBootstrap())); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $dataSetInstance; @@ -212,7 +212,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function isLocalNodeRegistered () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get a search criteria instance $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -241,7 +241,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $isRegistered = $resultInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: isRegistered=' . intval($isRegistered) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return result return $isRegistered; @@ -254,7 +254,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function registerLocalNode () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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()); @@ -266,7 +266,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryInsertDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -277,7 +277,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function updateLocalNode () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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()); @@ -302,7 +302,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -313,7 +313,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function findNodeLocalBySessionId ($sessionId) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: sessionId=' . $sessionId . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: sessionId=' . $sessionId . ' - CALLED!'); // Get search criteria $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -326,7 +326,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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; @@ -341,7 +341,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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)); @@ -359,7 +359,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryInsertDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . '] - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER - EXIT!'); } /** @@ -372,7 +372,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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)); @@ -393,7 +393,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -404,13 +404,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function isNodeRegistered (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -430,7 +430,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $isRegistered = $resultInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: isRegistered=' . intval($isRegistered) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: isRegistered=' . intval($isRegistered) . ' - EXIT!'); // Return registration status return $isRegistered; @@ -446,7 +446,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function registerNode (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on array elements assert(isset($nodeData[self::DB_COLUMN_NODE_ID])); @@ -461,7 +461,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->partialStub('nodeData=' . print_r($nodeData, TRUE)); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -475,13 +475,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function updateNode (array $nodeData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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)) { @@ -505,7 +505,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $nodeInstance = NodeObjectFactory::createNodeInstance(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -517,7 +517,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -543,7 +543,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $hasUnpublished = $this->unpublishedEntriesInstance->valid(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return it return $hasUnpublished; @@ -559,7 +559,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function initEntryPublication () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); /* * Make sure that hasUnpublishedEntries() has been called first by @@ -591,7 +591,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $this->queryUpdateDataSet($dataSetInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); } /** @@ -602,9 +602,9 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function removeNonPublicDataFromArray(array $data) { // Currently call only inner method - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: data[]=' . gettype($data)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: data[]=' . gettype($data)); // Return cleaned data return $data; @@ -618,7 +618,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function getResultFromExcludedSender (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Assert on required array field assert(isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER])); @@ -639,7 +639,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return result instance return $resultInstance; @@ -655,7 +655,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function getResultFromKeyValue ($key, $value) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); // Get max recipients $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients'); @@ -670,7 +670,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem $resultInstance = $this->doSelectByCriteria($searchInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: EXIT!'); // Return result instance return $resultInstance; @@ -683,7 +683,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem */ public function enableAcceptDhtBootstrap () { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Enabling DHT bootstrap requests ...'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: Enabling DHT bootstrap requests ...'); // Is the node already registered? if ($this->isLocalNodeRegistered()) { diff --git a/application/hub/classes/database/frontend/node/class_NodeInformationDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeInformationDatabaseWrapper.php index df0ffc20d..92fb1b5d3 100644 --- a/application/hub/classes/database/frontend/node/class_NodeInformationDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/node/class_NodeInformationDatabaseWrapper.php @@ -190,7 +190,7 @@ class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements Node */ public function removeNonPublicDataFromArray(array $data) { // Currently call only inner method - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-WRAPPER: Calling parent::removeNonPublicDataFromArray(data) ...'); $data = parent::removeNonPublicDataFromArray($data); // Return cleaned data diff --git a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php index 68bfbd3ba..1e0e7784a 100644 --- a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php @@ -109,7 +109,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look // Is the package valid? if (!isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER])) { // Invalid package found, please report this - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, TRUE)); + $this->debugBackTrace(': packageData=' . print_r($packageData, TRUE)); } // END - if // Get a search criteria instance from package data diff --git a/application/hub/classes/decoder/package/class_PackageDecoder.php b/application/hub/classes/decoder/package/class_PackageDecoder.php index 7cf35191d..5d11619aa 100644 --- a/application/hub/classes/decoder/package/class_PackageDecoder.php +++ b/application/hub/classes/decoder/package/class_PackageDecoder.php @@ -82,7 +82,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[' . __METHOD__ . ':' . __LINE__ . ']: unhandledDataLeft=' . intval($unhandledDataLeft)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: unhandledDataLeft=' . intval($unhandledDataLeft)); return $unhandledDataLeft; } @@ -99,7 +99,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -114,7 +114,7 @@ class PackageDecoder extends BaseDecoder implements Decodeable, Registerable { ); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER[' . __METHOD__ . ':' . __LINE__ . ']: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-DECODER: decodedData(' . count($decodedData) . ')=' . print_r($decodedData, TRUE)); // Next get a recipient-discovery instance $discoveryInstance = PackageDiscoveryFactory::createPackageDiscoveryInstance(); @@ -125,7 +125,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -159,7 +159,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 4d5c5ff0d..31b16fba6 100644 --- a/application/hub/classes/dht/class_BaseDht.php +++ b/application/hub/classes/dht/class_BaseDht.php @@ -170,7 +170,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[' . __METHOD__ . ':' . __LINE__ . '] Pushing entry with ' . count($current) . ' elements to stack ' . self::STACKER_NAME_PENDING_PUBLISHING . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-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 } @@ -185,7 +185,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[' . __METHOD__ . ':' . __LINE__ . '] isPending=' . intval($isPending)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT isPending=' . intval($isPending)); return $isPending; } @@ -199,7 +199,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { $isBooting = $this->getStateInstance()->ifDhtIsBooting(); // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT[' . __METHOD__ . ':' . __LINE__ . '] isBooting=' . intval($isBooting)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT isBooting=' . intval($isBooting)); return $isBooting; } @@ -230,9 +230,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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 91b0afed4..77326645c 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -184,18 +184,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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]); @@ -245,7 +245,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[' . __METHOD__ . ':' . __LINE__ . ']: 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'); @@ -253,7 +253,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -283,7 +283,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert(count($current) > 0); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE[' . __METHOD__ . ':' . __LINE__ . ']: 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. @@ -313,7 +313,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { // If no node is in the list (array), skip the rest of this method if (count($nodeList) == 0) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE[' . __METHOD__ . ':' . __LINE__ . ']: No node record has been returned.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: No node record has been returned.'); // Abort here return; @@ -352,7 +352,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { while ($resultInstance->next()) { // Get current entry $current = $resultInstance->current(); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE[' . __METHOD__ . ':' . __LINE__ . ']: current=' . print_r($current, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-FACADE: current=' . print_r($current, TRUE)); // Add instance to recipient list array_push($recipients, $current); diff --git a/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php b/application/hub/classes/discovery/node/class_UniversalNodeLocatorDiscovery.php index 105a66f99..48495b276 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[' . __METHOD__ . ':' . __LINE__ . ']: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[' . __METHOD__ . ':' . __LINE__ . ']: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/package/class_PackageRecipientDiscovery.php b/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php index 9c7143470..d6e498398 100644 --- a/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php @@ -116,10 +116,10 @@ class PackageRecipientDiscovery extends BaseRecipientDiscovery implements Discov */ // Debug output (may flood) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' matches own ip (external=' . HubTools::determineOwnExternalAddress() . ' or internal=' . HubTools::determineOwnInternalAddress() . ')'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' matches own ip (external=' . HubTools::determineOwnExternalAddress() . ' or internal=' . HubTools::determineOwnInternalAddress() . ')'); } else { // Debug output (may flood) - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' is different than own external address (' . HubTools::determineOwnExternalAddress() . ') nor internal address (' . HubTools::determineOwnInternalAddress() . '), need to forward (not yet implemented)!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-DISCOVERY: Recipient ' . $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' is different than own external address (' . HubTools::determineOwnExternalAddress() . ') nor internal address (' . HubTools::determineOwnInternalAddress() . '), need to forward (not yet implemented)!'); // This package is to be delivered to someone else, so add it // @TODO Unfinished: $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]); diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 3977293a0..ac471d66a 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -59,7 +59,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $discoveryInstance = new PackageSocketDiscovery(); // Output debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Initialized.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Initialized.'); // Return the prepared instance return $discoveryInstance; @@ -74,7 +74,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -89,7 +89,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $protocolName = $protocolInstance->getProtocolName(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $protocolName . ',poolEntriesInstance=' . $poolInstance->getPoolEntriesInstance()->__toString()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName . ',poolEntriesInstance=' . $poolInstance->getPoolEntriesInstance()->__toString()); /* * Now we need to choose again. It is whether we are speaking with a hub @@ -98,7 +98,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ foreach ($poolInstance->getPoolEntriesInstance()->getArrayFromList($protocolName) as $listenerInstance) { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -106,16 +106,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: listenerInstance=' . $listenerInstance->__toString()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: listenerInstance=' . $listenerInstance->__toString()); // Return it return $listenerInstance; @@ -134,7 +134,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ public function discoverSocket (array $packageData, $connectionType) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: connectionType=' . $connectionType . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': connectionType=' . $connectionType . ' - CALLED!'); // Assert on type and recipient assert($connectionType != BaseConnectionHelper::CONNECTION_TYPE_SERVER); @@ -172,18 +172,21 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera */ $socketInstance = $listenerInstance->getPoolInstance()->getSocketFromPackageData($packageData, $connectionType); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-DISCOVERY: socketInstance[]=%s', gettype($socketInstance))); + // Is it FALSE, the recipient isn't known to us and we have no connection to it if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getSocketLastError() > 0)) { // Try to create a new socket resource try { // Possibly noisy debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Trying to establish a ' . strtoupper($protocolInstance) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Trying to establish a ' . strtoupper($protocolInstance) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...'); // Get a socket resource from our factory (if succeeded) $socketInstance = SocketFactory::createSocketFromPackageData($packageData, $protocolInstance); } catch (SocketConnectionException $e) { // The connection fails of being established, so log it away - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); } } // END - if @@ -193,20 +196,20 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera $helperInstance = Registry::getRegistry()->getInstance('connection'); // Possibly noisy debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: 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); } catch (InvalidSocketException $e) { // This cannot be fixed, so log it away - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage()); // Make any failed attempts to 'FALSE' $socketInstance = NULL; } // And return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: 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/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index 8e657c6cd..718e6b1ac 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -7,6 +7,7 @@ use Hub\Listener\BaseListener; use Hub\Network\Package\NetworkPackage; // Import framework stuff +use CoreFramework\Bootstrap\FrameworkBootstrap; use CoreFramework\Configuration\FrameworkConfiguration; use CoreFramework\Factory\ObjectFactory; use CoreFramework\Listener\Listenable; @@ -65,7 +66,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[' . __METHOD__ . ':' . __LINE__ . ']: 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)) { @@ -73,19 +74,19 @@ class SocketFactory extends ObjectFactory { $socketInstance = Registry::getRegistry()->getInstance($registryKey); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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 $socketResource = call_user_func($className . '::createConnectionFromPackageData', $packageData); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Created socket ' . $socketResource . '(' . gettype($socketResource) . ') from class ' . $className . '.'); + //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Created socket ' . $socketResource . '(' . gettype($socketResource) . ') from class ' . $className . '.'); // Construct container class, this won't be reached if an exception is thrown $socketInstance = self::createObjectByConfiguredName('socket_container_class', array($socketResource, NULL, $packageData)); @@ -94,7 +95,7 @@ class SocketFactory extends ObjectFactory { Registry::getRegistry()->addInstance($registryKey, $socketInstance); // Debug message - //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Socket is now registered in registry.'); + //*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FACTORY: Socket is now registered in registry.'); } // Return the socket (container) instance @@ -113,7 +114,7 @@ class SocketFactory extends ObjectFactory { $socketFile = self::createTempPathForFile($listenerInstance->getConfigInstance()->getConfigEntry('ipc_socket_file_name')); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: socketFile=' . $socketFile . ' ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: socketFile=' . $socketFile . ' ...'); // File name must not be empty assert(!empty($socketFile)); @@ -130,6 +131,9 @@ class SocketFactory extends ObjectFactory { // Get container from it $socketInstance = self::createObjectByConfiguredName('socket_container_class', array($socketResource, NULL, $packageData)); + // Debug message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FILE_LISTENER: socketInstance[]=%s', gettype($socketInstance))); + // Is the socket resource valid? if (!$socketInstance->isValidSocket()) { // Something bad happened @@ -148,7 +152,7 @@ class SocketFactory extends ObjectFactory { // Is the file there? if ((FrameworkBootstrap::isReachableFilePath($packageData[0])) && (file_exists($packageData[0]))) { // Old socket found - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: WARNING: Old socket at ' . $packageData[0] . ' found. Will not start.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: WARNING: Old socket at ' . $packageData[0] . ' found. Will not start.'); // Shutdown this socket $socketInstance->shutdownSocket(); @@ -158,7 +162,7 @@ class SocketFactory extends ObjectFactory { } // END - if // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Binding to ' . $packageData[0] . ' ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Binding to ' . $packageData[0] . ' ...'); // Try to bind to it if (!$socketInstance->bindSocketTo($packageData[0])) { @@ -167,14 +171,14 @@ class SocketFactory extends ObjectFactory { } // END - if // Start listen for connections - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Listening for connections.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Listening for connections.'); if (!$socketInstance->listenOnSocket()) { // Handle this socket error with a faked recipientData array $listenerInstance->handleSocketError(__METHOD__, __LINE__, $socketInstance, $packageData); } // END - if // Now, we want non-blocking mode - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Setting non-blocking mode.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Setting non-blocking mode.'); if (!$socketInstance->enableSocketNonBlocking()) { // Handle this socket error with a faked recipientData array $listenerInstance->handleSocketError(__METHOD__, __LINE__, $socketInstance, $packageData); diff --git a/application/hub/classes/factories/states/communicator/class_CommunicatorStateFactory.php b/application/hub/classes/factories/states/communicator/class_CommunicatorStateFactory.php index affed62bd..763e0bdc2 100644 --- a/application/hub/classes/factories/states/communicator/class_CommunicatorStateFactory.php +++ b/application/hub/classes/factories/states/communicator/class_CommunicatorStateFactory.php @@ -54,7 +54,7 @@ class CommunicatorStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName($className, array($communicatorInstance)); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Communicator state has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('COMMUNICATOR-STATE-FACTORY: Communicator state has changed from ' . $communicatorInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the communicator instance $communicatorInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/factories/states/crawler/class_CrawlerStateFactory.php b/application/hub/classes/factories/states/crawler/class_CrawlerStateFactory.php index d1ca0013c..e5e285dc7 100644 --- a/application/hub/classes/factories/states/crawler/class_CrawlerStateFactory.php +++ b/application/hub/classes/factories/states/crawler/class_CrawlerStateFactory.php @@ -57,7 +57,7 @@ class CrawlerStateFactory extends ObjectFactory { $crawlerInstance = Registry::getRegistry()->getInstance('crawler'); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Crawler state has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-STATE-FACTORY: Crawler state has changed from ' . $crawlerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the crawler instance $crawlerInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/factories/states/cruncher/class_CruncherStateFactory.php b/application/hub/classes/factories/states/cruncher/class_CruncherStateFactory.php index d89bb97c5..d5c3dd458 100644 --- a/application/hub/classes/factories/states/cruncher/class_CruncherStateFactory.php +++ b/application/hub/classes/factories/states/cruncher/class_CruncherStateFactory.php @@ -58,7 +58,7 @@ class CruncherStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName($className); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Cruncher state has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRUNCHER-STATE-FACTORY: Cruncher state has changed from ' . $cruncherInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the cruncher instance $cruncherInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/factories/states/dht/class_DhtStateFactory.php b/application/hub/classes/factories/states/dht/class_DhtStateFactory.php index b940aafd3..9085cd3fc 100644 --- a/application/hub/classes/factories/states/dht/class_DhtStateFactory.php +++ b/application/hub/classes/factories/states/dht/class_DhtStateFactory.php @@ -54,7 +54,7 @@ class DhtStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName($className, array($dhtInstance)); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: DHT state has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE-FACTORY: DHT state has changed from ' . $dhtInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the DHT instance $dhtInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/factories/states/miner/class_MinerStateFactory.php b/application/hub/classes/factories/states/miner/class_MinerStateFactory.php index eb2bf1b1e..add7355f5 100644 --- a/application/hub/classes/factories/states/miner/class_MinerStateFactory.php +++ b/application/hub/classes/factories/states/miner/class_MinerStateFactory.php @@ -57,7 +57,7 @@ class MinerStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName($className); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Miner state has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MINER-STATE-FACTORY: Miner state has changed from ' . $minerInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the miner instance $minerInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/factories/states/node/class_NodeStateFactory.php b/application/hub/classes/factories/states/node/class_NodeStateFactory.php index c642d6dac..eacbc0dc6 100644 --- a/application/hub/classes/factories/states/node/class_NodeStateFactory.php +++ b/application/hub/classes/factories/states/node/class_NodeStateFactory.php @@ -64,7 +64,7 @@ class NodeStateFactory extends ObjectFactory { $stateInstance = self::createObjectByConfiguredName($className, array($nodeInstance)); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Node state has changed from ' . $nodeInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-STATE-FACTORY: Node state has changed from ' . $nodeInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.'); // Once we have that state, set it in the node instance $nodeInstance->setStateInstance($stateInstance); diff --git a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php index 075515046..9316ab08c 100644 --- a/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php +++ b/application/hub/classes/filter/cruncher/class_CruncherInitializationFilter.php @@ -95,7 +95,7 @@ class CruncherInitializationFilter extends BaseCruncherFilter implements Filtera } catch (ClassNotFoundException $e) { // This exception means, the cruncher mode is invalid. // @TODO Can we rewrite this to app_exit() ? - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: cruncher mode ' . $cruncherMode . ' is invalid.'); + $this->debugBackTrace(': cruncher mode ' . $cruncherMode . ' is invalid.'); } } } diff --git a/application/hub/classes/filter/miner/class_MinerInitializationFilter.php b/application/hub/classes/filter/miner/class_MinerInitializationFilter.php index 7595fabcd..1c8224883 100644 --- a/application/hub/classes/filter/miner/class_MinerInitializationFilter.php +++ b/application/hub/classes/filter/miner/class_MinerInitializationFilter.php @@ -95,7 +95,7 @@ class MinerInitializationFilter extends BaseMinerFilter implements Filterable { } catch (ClassNotFoundException $e) { // This exception means, the miner mode is invalid. // @TODO Can we rewrite this to app_exit() ? - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: miner mode ' . $minerMode . ' is invalid.'); + $this->debugBackTrace(': miner mode ' . $minerMode . ' is invalid.'); } } } diff --git a/application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php b/application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php index fbe24d9ef..4c15fe0ad 100644 --- a/application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php +++ b/application/hub/classes/filter/miner/class_MinerPhpRequirementsFilter.php @@ -77,11 +77,11 @@ class MinerPhpRequirementsFilter extends BaseMinerFilter implements Filterable { // If scrypt() is not found (ext-scrypt) then the "Hubcoins reward" is not working if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) { // Mark it as working - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.'); $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE); } else { // Not working (not all have ext-scrypt installed - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.'); } // Are all tests passed? diff --git a/application/hub/classes/filter/node/class_NodeInitializationFilter.php b/application/hub/classes/filter/node/class_NodeInitializationFilter.php index ee23d19b9..d5230f65b 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('[' . __METHOD__ . ':' . __LINE__ . ']: node mode ' . $nodeMode . ' is invalid.'); + $this->debugBackTrace(': node mode ' . $nodeMode . ' is invalid.'); } // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Node ' . $nodeMode . ' has been added to registry.'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-INIT-FILTER: Node ' . $nodeMode . ' has been added to registry.'); } } diff --git a/application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php b/application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php index f9a9ea473..098a5ae42 100644 --- a/application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php +++ b/application/hub/classes/filter/node/class_NodePhpRequirementsFilter.php @@ -80,21 +80,21 @@ class NodePhpRequirementsFilter extends BaseNodeFilter implements Filterable { // If scrypt() is not found (ext-scrypt) then the "Hubcoins reward" is not working if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) { // Mark it as working - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.'); $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE); } else { // Not working (not all have ext-scrypt installed - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.'); } // If uuid_create() is not found (ext-uuid) then some keys are a bit weaker if ((extension_loaded('uuid')) && (is_callable('uuid_create'))) { // Mark it as working - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-uuid and a callable uuid_create() function found. UUID "entropy" available.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-uuid and a callable uuid_create() function found. UUID "entropy" available.'); $this->getConfigInstance()->setConfigEntry('extension_uuid_loaded', TRUE); } else { // Not working (not all have ext-uuid installed - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER[' . __METHOD__ . ':' . __LINE__ . '] ext-uuid not found or uuid_create() function not found. UUID "entropy" disabled.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER ext-uuid not found or uuid_create() function not found. UUID "entropy" disabled.'); } // Are all tests passed? diff --git a/application/hub/classes/handler/chunks/class_ChunkHandler.php b/application/hub/classes/handler/chunks/class_ChunkHandler.php index d7a93bb9a..5993cc7d0 100644 --- a/application/hub/classes/handler/chunks/class_ChunkHandler.php +++ b/application/hub/classes/handler/chunks/class_ChunkHandler.php @@ -141,7 +141,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function initHandler () { // Noisy debug line: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Initializing handler ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Initializing handler ...'); // Init finalPackageChunks $this->finalPackageChunks = array( @@ -173,7 +173,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function isChunkHashValid (array $chunkSplits) { // Noisy debug line: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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])); @@ -186,7 +186,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable $isValid = ($chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] === $chunkHash); // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: chunkHash=' . $chunkHash . ',isValid=' . intval($isValid)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: chunkHash=' . $chunkHash . ',isValid=' . intval($isValid)); // ... and return it return $isValid; @@ -225,7 +225,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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]; @@ -304,7 +304,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ private function verifyChunkSerialNumbers () { // Debug message - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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'])); @@ -318,7 +318,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable $nextSerial = $this->fragmenterInstance->getNextHexSerialNumber($finalHash); // Debug output - //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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) { @@ -347,13 +347,13 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable $this->rawPackageData = ''; // That went well, so start assembling all chunks - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: serialNumber=' . $serialNumber . ',hashes=' . $this->finalPackageChunks['hashes'][$serialNumber] . ' - validating ...'); + //* 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 @@ -366,12 +366,12 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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]); @@ -409,7 +409,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable $finalHash = $this->generateFinalHash($this->rawPackageData); // Is it the same? - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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]); } @@ -528,7 +528,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable // Is the generated hash from data same ("valid") as given hash? if (!$this->isChunkHashValid($chunkSplits)) { // Do some logging - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Chunk content is not validating against given hash.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Chunk content is not validating against given hash.'); // Re-request this chunk (trust the hash in index # 0) $this->rerequestChunkBySplitsArray($chunkSplits); @@ -540,7 +540,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable // Is the serial number valid (chars 0-9, length equals PackageFragmenter::MAX_SERIAL_LENGTH)? if (!$this->isSerialNumberValid($chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL])) { // Do some logging - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Chunk serial number ' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ' for hash ' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] . ' is invalid.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Chunk serial number ' . $chunkSplits[self::CHUNK_SPLITS_INDEX_SERIAL] . ' for hash ' . $chunkSplits[self::CHUNK_SPLITS_INDEX_HASH] . ' is invalid.'); // Re-request this chunk $this->rerequestChunkBySplitsArray($chunkSplits); @@ -624,7 +624,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable break; default: // Invalid step found - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Invalid step ' . $this->finalPackageChunks['assemble_steps'] . ' detected.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: Invalid step ' . $this->finalPackageChunks['assemble_steps'] . ' detected.'); break; } // END - switch } @@ -638,11 +638,11 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable */ public function ifRawPackageDataIsAvailable () { // Check it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER: isRawPackageDataAvailable=' . intval($isRawPackageDataAvailable)); return $isRawPackageDataAvailable; } @@ -657,7 +657,7 @@ class ChunkHandler extends BaseHandler implements HandleableChunks, Registerable assert($this->ifRawPackageDataIsAvailable()); // Then feed it into the next stacker - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CHUNK-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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/message-types/announcement/class_NodeMessageAnnouncementHandler.php b/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php index f4acbb39c..2931e81fa 100644 --- a/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/classes/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php @@ -139,7 +139,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl assert(isset($messageData[$key])); // Add it - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Adding messageData[' . $key . ']=' . $messageData[$key] . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Adding messageData[' . $key . ']=' . $messageData[$key] . ' ...'); $dataSetInstance->addCriteria($key, $messageData[$key]); } // END - foreach } @@ -152,12 +152,12 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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]); @@ -166,7 +166,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[' . __METHOD__ . ':' . __LINE__ . ']: 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)); diff --git a/application/hub/classes/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/classes/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index 0f914e92b..f09efd7d4 100644 --- a/application/hub/classes/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/classes/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -119,12 +119,12 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme parent::addArrayToDataSet($dataSetInstance, $messageData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: messageData[' . $key . ']=' . $messageData[$key]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData[' . $key . ']=' . $messageData[$key]); // Is it there? assert(isset($messageData[$key])); diff --git a/application/hub/classes/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/classes/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index 63ccd2468..c431f3a97 100644 --- a/application/hub/classes/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/classes/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -148,12 +148,12 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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]); @@ -162,7 +162,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[' . __METHOD__ . ':' . __LINE__ . ']: 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)); diff --git a/application/hub/classes/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/classes/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php index 4cbce50c2..a9ca0bf3f 100644 --- a/application/hub/classes/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/classes/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -131,12 +131,12 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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)); @@ -152,7 +152,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha ); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Got a node list of ' . count($nodeList) . ' entry/-ies back.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Got a node list of ' . count($nodeList) . ' entry/-ies back.'); // Set it serialized in configuration (temporarily) $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList))); diff --git a/application/hub/classes/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/classes/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index 886a118a4..375e67736 100644 --- a/application/hub/classes/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/classes/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -74,7 +74,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle // Are node id and session id the same? if (($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_NODE_ID] == $nodeInstance->getNodeId()) && ($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_SESSION_ID] == $nodeInstance->getSessionId())) { // Both are equal - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SELF-CONNECT[' . __METHOD__ . ':' . __LINE__ . ']: Have connected to myself, both node and session id are equal!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SELF-CONNECT: Have connected to myself, both node and session id are equal!'); // ... and change state $nodeInstance->getStateInstance()->nodeHasSelfConnected(); diff --git a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php index f3622ffec..29a0a4545 100644 --- a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php +++ b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php @@ -79,7 +79,7 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $this->setErrorCode(self::SOCKET_ERROR_UNHANDLED); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Handling TCP package from resource=' . $socketArray[BasePool::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[BasePool::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[BasePool::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',last error=' . socket_strerror($this->lastSocketError)); /* * Read the raw data from socket. If you change PHP_BINARY_READ to @@ -92,13 +92,13 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { $this->lastSocketError = socket_last_error($socketArray[BasePool::SOCKET_ARRAY_INSTANCE]); // Debug output of read data length - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[BasePool::SOCKET_ARRAY_INSTANCE] . ',error=' . socket_strerror($this->lastSocketError)); - //* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: rawData=' . $rawData); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[BasePool::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[' . __METHOD__ . ':' . __LINE__ . ']: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[BasePool::SOCKET_ARRAY_INSTANCE]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-HANDLER: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[BasePool::SOCKET_ARRAY_INSTANCE]); /* * Error code 11 (Resource temporary unavailable) can be safely @@ -122,7 +122,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[' . __METHOD__ . ':' . __LINE__ . ']: 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/handler/protocol/class_BaseProtocolHandler.php b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php index cbdc7f3c1..222b467cf 100644 --- a/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php +++ b/application/hub/classes/handler/protocol/class_BaseProtocolHandler.php @@ -76,13 +76,13 @@ class BaseProtocolHandler extends BaseHandler { */ protected final function isValidUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',regex=' . $regex . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ',regex=' . $regex . ' - CALLED!'); // Very basic regex check $isValid = (preg_match($this->getRegularExpression(), $unl) === 1); // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: isValid=' . intval($isValid) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': isValid=' . intval($isValid) . ' - EXIT!'); return $isValid; } @@ -107,7 +107,7 @@ class BaseProtocolHandler extends BaseHandler { */ protected function parseGenericUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ' - CALLED!'); // Make sure the UNL is valid assert($this->isValidUniversalNodeLocator($unl)); @@ -129,7 +129,7 @@ class BaseProtocolHandler extends BaseHandler { ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); // Return the generic array return $unlData; @@ -190,14 +190,14 @@ class BaseProtocolHandler extends BaseHandler { $internalUnl = HubTools::determineOwnInternalAddress(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ',externalUnl=' . $externalUnl . ',internalUnl=' . $internalUnl); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': 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('[' . __METHOD__ . ':' . __LINE__ . ']: ifMatches=' . intval($ifMatches)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': 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 8e0376aac..2ab056d74 100644 --- a/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php +++ b/application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php @@ -90,7 +90,7 @@ class BaseIpV4ProtocolHandler extends BaseProtocolHandler { */ protected function parseUniversalNodeLocator ($unl) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl . ' - CALLED!'); // First generic parse $unlData = parent::parseGenericUniversalNodeLocator($unl); @@ -110,7 +110,7 @@ class BaseIpV4ProtocolHandler extends BaseProtocolHandler { unset($unlData[UniversalNodeLocator::UNL_PART_EXTRA]); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unlData=' . print_r($unlData, TRUE) . ' - EXIT!'); return $unlData; } @@ -123,7 +123,7 @@ class BaseIpV4ProtocolHandler extends BaseProtocolHandler { */ public function isValidUniversalNodeLocatorByPackageData (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': CALLED!'); // Is 'recipient' there? assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])); @@ -135,7 +135,7 @@ class BaseIpV4ProtocolHandler extends BaseProtocolHandler { $isValid = $this->isValidUniversalNodeLocator($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: PACKAGE_DATA_RECIPIENT=' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ',isValid[' . gettype($isValid) . ']=' . intval($isValid)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': 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) { @@ -157,7 +157,7 @@ class BaseIpV4ProtocolHandler extends BaseProtocolHandler { } // END - if // Return result - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: isValid=' . intval($isValid) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': isValid=' . intval($isValid) . ' - EXIT!'); return $isValid; } diff --git a/application/hub/classes/handler/raw_data/class_BaseDataHandler.php b/application/hub/classes/handler/raw_data/class_BaseDataHandler.php index 37f427aec..dcc7896e1 100644 --- a/application/hub/classes/handler/raw_data/class_BaseDataHandler.php +++ b/application/hub/classes/handler/raw_data/class_BaseDataHandler.php @@ -113,7 +113,7 @@ abstract class BaseDataHandler extends BaseHandler { */ protected function prepareAnswerMessage (array $messageData, Deliverable $packageInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Going to send an answer message for ' . $this->getHandlerName() . ' ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER: Going to send an answer message for ' . $this->getHandlerName() . ' ...'); // Get a helper instance based on this handler's name $helperInstance = ObjectFactory::createObjectByConfiguredName('node_answer_' . $this->getHandlerName() . '_helper_class', array($messageData)); @@ -142,7 +142,7 @@ abstract class BaseDataHandler extends BaseHandler { $this->removeMessageConfigurationData($messageData); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Answer message has been prepared.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER: Answer message has been prepared.'); } /** @@ -154,7 +154,7 @@ abstract class BaseDataHandler extends BaseHandler { */ protected function prepareNextMessage (array $messageData, Deliverable $packageInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Going to send next message ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER: Going to send next message ...'); // Get a helper instance based on this handler's name $helperInstance = ObjectFactory::createObjectByConfiguredName('node_next_' . $this->getHandlerName() . '_helper_class', array($messageData)); @@ -183,7 +183,7 @@ abstract class BaseDataHandler extends BaseHandler { $this->removeMessageConfigurationData($messageData); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Next message has been prepared.'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('MESSAGE-HANDLER: Next message has been prepared.'); } /** diff --git a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php index 10fd8441c..3ca61c854 100644 --- a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php @@ -236,7 +236,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg */ private function getRawDataFromPackageArray (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: 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))); @@ -245,25 +245,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: chunkHashes[]=' . count($chunkHashes) . ',chunkData[]=' . count($chunkData)); + //* 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: Returning zero bytes from ' . __METHOD__ . '!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Returning zero bytes from ' . __METHOD__ . '!'); return ''; } } @@ -295,7 +295,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg // Is the final hash set? if ($finalHash !== TRUE) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: 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; @@ -311,11 +311,11 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg // Fill sending buffer with data while (strlen($dataStream) > 0) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: packageData=' . print_r($packageData, TRUE)); // Convert the package data array to a raw data stream $dataStream = $this->getRawDataFromPackageArray($packageData); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Adding ' . strlen($dataStream) . ' bytes to the sending buffer ...'); $rawData .= $dataStream; } // END - while @@ -329,7 +329,7 @@ class BaseConnectionHelper extends BaseHubSystemHelper implements Visitable, Reg $encodedData = $this->getOutputStreamInstance()->streamData($rawData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketResource[]=' . gettype($this->getSocketResource()) . PHP_EOL); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: socketResource[]=' . gettype($this->getSocketResource()) . PHP_EOL); // Init array $encodedDataArray = array( @@ -354,7 +354,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[' . __METHOD__ . ':' . __LINE__ . ']: ' . $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 f46985914..8445a5696 100644 --- a/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/class_BaseIpV4ConnectionHelper.php @@ -122,7 +122,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { $timeout = $this->getConfigInstance()->getConfigEntry('socket_timeout_seconds'); // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Trying to connect to ' . $unlData[UniversalNodeLocator::UNL_PART_ADDRESS] . ':' . $unlData[UniversalNodeLocator::UNL_PART_PORT] . ' with socketResource[' . gettype($this->getSocketInstance()->getSocketResource() . ']=' . $this->getSocketInstance()->getSocketResource() . ' ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Trying to connect to ' . $unlData[UniversalNodeLocator::UNL_PART_ADDRESS] . ':' . $unlData[UniversalNodeLocator::UNL_PART_PORT] . ' with socketResource[' . gettype($this->getSocketInstance()->getSocketResource() . ']=' . $this->getSocketInstance()->getSocketResource() . ' ...'); // Get current time $hasTimedOut = FALSE; @@ -134,14 +134,14 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { $socketError = socket_last_error($this->getSocketInstance()); // Log error code and status - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketError=' . $socketError . ',isConnected=' . intval($isConnected)); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: socketError=' . $socketError . ',isConnected=' . intval($isConnected)); // Skip any errors which may happen on non-blocking connections if (($socketError == SOCKET_EINPROGRESS) || ($socketError == SOCKET_EALREADY)) { // Now, is that attempt within parameters? if ((time() - $time) >= $timeout) { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: timeout=' . $timeout .' reached, connection attempt failed.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: timeout=' . $timeout .' reached, connection attempt failed.'); // Didn't work within timeout $isConnected = FALSE; @@ -153,7 +153,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { $this->idle(1000); } elseif ($socketError != 0) { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketError=' . $socketError . ' detected.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: socketError=' . $socketError . ' detected.'); // Stop on everything else pronto $isConnected = FALSE; @@ -162,7 +162,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { } // END - while // Log error code - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: socketError=' . $socketError . ',isConnected=' . intval($isConnected) . ',hasTimedOut=' . intval($hasTimedOut) . ' after while() loop.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: socketError=' . $socketError . ',isConnected=' . intval($isConnected) . ',hasTimedOut=' . intval($hasTimedOut) . ' after while() loop.'); /* * All IPv4-based connections are non-blocking used by this program or @@ -172,7 +172,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { */ if (($hasTimedOut === FALSE) && ($socketError == SOCKET_EINPROGRESS)) { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Clearing "operation in progress" as this is for 99.999% chance a non-blocking I/O operation.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Clearing "operation in progress" as this is for 99.999% chance a non-blocking I/O operation.'); // A "connection in progress" has not timed out. All fine. $isConnected = TRUE; @@ -203,11 +203,11 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { * @return void */ protected final function markConnectionShuttedDown () { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $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 - $this->setSocketResource(FALSE); + $this->initSocketInstance(); } // ************************************************************************ @@ -362,7 +362,7 @@ class BaseIpV4ConnectionHelper extends BaseConnectionHelper { * @return void */ protected function socketErrorOperationInProgressHandler (StorableSocket $socketInstance, array $unlData) { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Operation is now in progress, this is usual for non-blocking connections and is no bug.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.'); } } diff --git a/application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php index c446e08ad..00229855e 100644 --- a/application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php @@ -87,7 +87,7 @@ class TcpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Setting socket resource ... (' . gettype($socketResource) . ')'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Setting socket resource ... (' . gettype($socketResource) . ')'); // Set the resource $helperInstance->setSocketResource($socketResource); @@ -116,7 +116,7 @@ class TcpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection $helperInstance->setHandlerInstance($handlerInstance); } catch (NoValidHostnameException $e) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Failed to resolve ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ':' . $e->getMessage()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Failed to resolve ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ':' . $e->getMessage()); // Is the recipient equal as configured IP if (substr($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], 0, strlen($helperInstance->getConfigInstance()->getConfigEntry('external_address'))) == $helperInstance->getConfigInstance()->getConfigEntry('external_address')) { @@ -149,7 +149,7 @@ class TcpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection // Now connect to it if (!$helperInstance->connectToPeerByUnlData($unlData)) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ',unlData=' . print_r($unlData, TRUE)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: helperInstance=' . $helperInstance->__toString() . ',unlData=' . print_r($unlData, TRUE)); // Handle socket error $helperInstance->handleSocketError(__METHOD__, __LINE__, $socketResource, $unlData); @@ -168,7 +168,7 @@ class TcpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection */ public function doShutdown () { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down socket resource ' . $this->getSocketResource()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Shutting down socket resource ' . $this->getSocketResource()); // Clear any previous errors socket_clear_error($this->getSocketResource()); diff --git a/application/hub/classes/helper/connection/ipv4/udp/class_UdpConnectionHelper.php b/application/hub/classes/helper/connection/ipv4/udp/class_UdpConnectionHelper.php index 24b3c3a63..6630711d3 100644 --- a/application/hub/classes/helper/connection/ipv4/udp/class_UdpConnectionHelper.php +++ b/application/hub/classes/helper/connection/ipv4/udp/class_UdpConnectionHelper.php @@ -51,7 +51,7 @@ class UdpConnectionHelper extends BaseIpV4ConnectionHelper implements Connection * @return $socketInstance An instance of a StorableSocket class */ public static function createConnectionFromPackageData (array $packageData) { - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: Unfinished method, packageData[]=' . count($packageData)); + $this->debugBackTrace(': Unfinished method, packageData[]=' . count($packageData)); } /** diff --git a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php index 725726a9f..5c296512a 100644 --- a/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php +++ b/application/hub/classes/helper/dht/class_DhtBootstrapHelper.php @@ -68,7 +68,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { */ public function loadDescriptorXml (Distributable $dhtInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Starting with DHT boostrap ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Starting with DHT boostrap ...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('dht_bootstrap_template_class'); @@ -91,7 +91,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { */ public function sendPackage (Distributable $dhtInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: CALLED!'); /* * Sanity check: Is the DHT in the approx. state? 'init' for bootstrap @@ -110,7 +110,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht { $packageInstance->enqueueRawDataFromTemplate($this); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: EXIT!'); } } diff --git a/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php b/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php index 5e26a71ff..c3099dda1 100644 --- a/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php +++ b/application/hub/classes/helper/dht/class_DhtPublishEntryHelper.php @@ -68,7 +68,7 @@ class DhtPublishEntryHelper extends BaseHubSystemHelper implements HelpableDht { */ public function loadDescriptorXml (Distributable $dhtInstance) { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Starting with publishing an entry ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Starting with publishing an entry ...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('dht_publish_entry_template_class'); diff --git a/application/hub/classes/helper/node/announcement/class_NodeAnnouncementHelper.php b/application/hub/classes/helper/node/announcement/class_NodeAnnouncementHelper.php index 4b86a02a8..78a6e566f 100644 --- a/application/hub/classes/helper/node/announcement/class_NodeAnnouncementHelper.php +++ b/application/hub/classes/helper/node/announcement/class_NodeAnnouncementHelper.php @@ -67,7 +67,7 @@ class NodeAnnouncementHelper extends BaseNodeHelper implements HelpableNode { */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Starting with announcement to upper hubs...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Starting with announcement to upper hubs...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class'); diff --git a/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php index 7309e1d39..888d9799c 100644 --- a/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php @@ -70,7 +70,7 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Attempting to answer an announcement...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Attempting to answer an announcement...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_answer_template_class'); diff --git a/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php index 0d0f12d7f..ad4a5a64c 100644 --- a/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php @@ -70,7 +70,7 @@ class NodeDhtBootstrapMessageAnswerHelper extends BaseHubAnswerHelper implements */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Attempting to answer a DHT bootstrap request...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Attempting to answer a DHT bootstrap request...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_dht_bootstrap_answer_template_class'); diff --git a/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php index e6f5f986e..afd0d34ed 100644 --- a/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php @@ -70,7 +70,7 @@ class NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper impleme */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Attempting to answer a request: node-list...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Attempting to answer a request: node-list...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_answer_template_class'); diff --git a/application/hub/classes/helper/node/connection/class_NodeSelfConnectHelper.php b/application/hub/classes/helper/node/connection/class_NodeSelfConnectHelper.php index 4c812a8ab..e4e9a6b75 100644 --- a/application/hub/classes/helper/node/connection/class_NodeSelfConnectHelper.php +++ b/application/hub/classes/helper/node/connection/class_NodeSelfConnectHelper.php @@ -67,7 +67,7 @@ class NodeSelfConnectHelper extends BaseNodeHelper implements HelpableNode { */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Attempting self-connect...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Attempting self-connect...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_self_connect_template_class'); diff --git a/application/hub/classes/helper/node/requests/class_NodeRequestNodeListHelper.php b/application/hub/classes/helper/node/requests/class_NodeRequestNodeListHelper.php index 97c54d746..fcc61c346 100644 --- a/application/hub/classes/helper/node/requests/class_NodeRequestNodeListHelper.php +++ b/application/hub/classes/helper/node/requests/class_NodeRequestNodeListHelper.php @@ -67,7 +67,7 @@ class NodeRequestNodeListHelper extends BaseNodeHelper implements HelpableNode { */ public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Attempting to request: node-list...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Attempting to request: node-list...'); // Get a XML template instance $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_request_node_list_template_class'); diff --git a/application/hub/classes/info/connection/class_ConnectionInfo.php b/application/hub/classes/info/connection/class_ConnectionInfo.php index 308d219e4..0eb2b484f 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('[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $listenerInstance->getProtocolName() . ',listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': 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('[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': 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('[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $helperInstance->getProtocolName() . ',helperInstance=' . $helperInstance->__toString() . ',socketResource=' . $helperInstance->getSocketResource() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': protocolName=' . $helperInstance->getProtocolName() . ',helperInstance=' . $helperInstance->__toString() . ',socketResource=' . $helperInstance->getSocketResource() . ' - CALLED!'); // Fill the generic array with several data from the listener: $this->setProtocolName($helperInstance->getProtocolName()); @@ -99,7 +99,7 @@ class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable { $this->setHelperInstance($helperInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': EXIT!'); } /** diff --git a/application/hub/classes/listener/class_BaseListener.php b/application/hub/classes/listener/class_BaseListener.php index 7d7f75f68..8a03b784c 100644 --- a/application/hub/classes/listener/class_BaseListener.php +++ b/application/hub/classes/listener/class_BaseListener.php @@ -255,7 +255,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $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); @@ -266,7 +266,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { } // END - if // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!'); } /** @@ -363,7 +363,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { default: // Everything else <> 0 // Unhandled error code detected, so first debug it because we may want to handle it like the others - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB[' . __METHOD__ . ':' . __LINE__ . '] UNKNOWN ERROR CODE = ' . $errorCode . ', MESSAGE = ' . socket_strerror($errorCode)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB UNKNOWN ERROR CODE = ' . $errorCode . ', MESSAGE = ' . socket_strerror($errorCode)); // Change it only in this class $errorName = BaseRawDataHandler::SOCKET_ERROR_UNKNOWN; @@ -402,14 +402,14 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { // Some new peers found? if ($left < 1) { // Debug message - //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); + //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); // Nothing new found return; } // END - if // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true)); // Do we have changed peers? if (in_array($this->getSocketResource(), $readers)) { @@ -423,7 +423,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { $newSocket = socket_accept($this->getSocketResource()); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketResource()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketResource()); // Array for timeout settings $options = array( @@ -500,7 +500,7 @@ class BaseListener extends BaseFrameworkSystem implements Visitable { $currentSocketData = $this->getIteratorInstance()->current(); // Handle it here, if not main server socket - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: currentSocketData=' . $currentSocketData[BasePool::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: currentSocketData=' . $currentSocketData[BasePool::SOCKET_ARRAY_INSTANCE] . ',type=' . $currentSocketData[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketInstance()->getSocketResource()); if (($currentSocketData[BasePool::SOCKET_ARRAY_CONN_TYPE] != BaseConnectionHelper::CONNECTION_TYPE_SERVER) && (!$currentSocketData[BasePool::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 1a31e49cb..0fb77065a 100644 --- a/application/hub/classes/listener/class_BaseListenerDecorator.php +++ b/application/hub/classes/listener/class_BaseListenerDecorator.php @@ -155,7 +155,7 @@ 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[' . __METHOD__ . ':' . __LINE__ . '] Going to handle over some raw data to receiver instance (' . $receiverInstance->__toString() . ') ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-LISTENER-DECORATOR Going to handle over some raw data to receiver instance (' . $receiverInstance->__toString() . ') ...'); $receiverInstance->addRawDataToIncomingStack($handlerInstance); } diff --git a/application/hub/classes/listener/socket/class_SocketFileListener.php b/application/hub/classes/listener/socket/class_SocketFileListener.php index bd205883d..b3423ab08 100644 --- a/application/hub/classes/listener/socket/class_SocketFileListener.php +++ b/application/hub/classes/listener/socket/class_SocketFileListener.php @@ -96,7 +96,7 @@ class SocketFileListener extends BaseListener implements Listenable { $this->setHandlerInstance($handlerInstance); // Output message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Socket listener now ready on socket ' . $socketFile . ' for service.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Socket listener now ready on socket ' . $socketFile . ' for service.'); } /** diff --git a/application/hub/classes/listener/tcp/class_TcpListener.php b/application/hub/classes/listener/tcp/class_TcpListener.php index a5182f89e..3fdf23f82 100644 --- a/application/hub/classes/listener/tcp/class_TcpListener.php +++ b/application/hub/classes/listener/tcp/class_TcpListener.php @@ -114,7 +114,7 @@ class TcpListener extends BaseListener implements Listenable { * that all connections on this port are now our resposibility to * send/recv data, disconnect, etc.. */ - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort()); if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) { // Handle this socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -134,7 +134,7 @@ class TcpListener extends BaseListener implements Listenable { } // END - if // Start listen for connections - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Listening for connections.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: Listening for connections.'); if (!socket_listen($mainSocket)) { // Handle this socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -154,7 +154,7 @@ class TcpListener extends BaseListener implements Listenable { } // END - if // Now, we want non-blocking mode - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Setting non-blocking mode.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: Setting non-blocking mode.'); if (!socket_set_nonblock($mainSocket)) { // Handle this socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -199,7 +199,7 @@ class TcpListener extends BaseListener implements Listenable { $this->setHandlerInstance($handlerInstance); // Output message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); } /** diff --git a/application/hub/classes/listener/udp/class_UdpListener.php b/application/hub/classes/listener/udp/class_UdpListener.php index a713502a9..ff4e14a5d 100644 --- a/application/hub/classes/listener/udp/class_UdpListener.php +++ b/application/hub/classes/listener/udp/class_UdpListener.php @@ -80,7 +80,7 @@ class UdpListener extends BaseListener implements Listenable { * that all connections on this port are now our resposibility to * send/recv data, disconnect, etc.. */ - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort()); if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) { // Handle the socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -100,7 +100,7 @@ class UdpListener extends BaseListener implements Listenable { } // END - if // Now, we want non-blocking mode - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Setting non-blocking mode.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Setting non-blocking mode.'); if (!socket_set_nonblock($mainSocket)) { // Handle the socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -120,7 +120,7 @@ class UdpListener extends BaseListener implements Listenable { } // END - if // Set the option to reuse the port - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Setting re-use address option.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Setting re-use address option.'); if (!socket_set_option($mainSocket, SOL_SOCKET, SO_REUSEADDR, 1)) { // Handle the socket error with a faked recipientData array $this->handleSocketError(__METHOD__, __LINE__, $mainSocket, array('0.0.0.0', '0')); @@ -149,7 +149,7 @@ class UdpListener extends BaseListener implements Listenable { $this->setHandlerInstance($handlerInstance); // Output message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: UDP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: UDP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.'); } /** @@ -179,7 +179,7 @@ class UdpListener extends BaseListener implements Listenable { return; } elseif ($lastError > 0) { // Other error detected - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Error detected: ' . socket_strerror($lastError)); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Error detected: ' . socket_strerror($lastError)); // Skip further processing return; @@ -189,7 +189,7 @@ class UdpListener extends BaseListener implements Listenable { } // END - if // Debug only - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: Handling UDP package with size ' . strlen($rawData) . ' from peer ' . $peer . ':' . $port); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UDP-LISTENER: Handling UDP package with size ' . strlen($rawData) . ' from peer ' . $peer . ':' . $port); } /** diff --git a/application/hub/classes/nodes/boot/class_HubBootNode.php b/application/hub/classes/nodes/boot/class_HubBootNode.php index 65533c551..4d8dfd58c 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('[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(': unl=' . $unl); // Now check if the IP address matches one of the bootstrap nodes if ($this->ifAddressMatchesBootstrapNodes($unl)) { diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 3e2f7bb7c..e873f212d 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -203,7 +203,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $this->bootUnl = $unl; // Output message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: UNL matches remote address ' . $unl . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . ': UNL matches remote address ' . $unl . '.'); // Stop further searching break; @@ -218,7 +218,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $this->bootUnl = $unl; // Output message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: UNL matches listen address ' . $unl . '.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . ': UNL matches listen address ' . $unl . '.'); // Stop further searching break; @@ -499,7 +499,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function doSelfConnection (Taskable $taskInstance) { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')'); // Get a helper instance $helperInstance = ObjectFactory::createObjectByConfiguredName('node_self_connect_helper_class', array($this)); @@ -514,7 +514,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $helperInstance->sendPackage($this); // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Self Connection: FINISHED'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: FINISHED'); } /** @@ -552,7 +552,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function initializeListenerPool () { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Initialize listener: START'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: START'); // Get a new pool instance $this->setListenerPoolInstance(ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this))); @@ -624,7 +624,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $this->getListenerPoolInstance()->addListener($decoratorInstance); // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Initialize listener: FINISHED.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: FINISHED.'); } /** @@ -680,13 +680,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function ifNodeIsAnnouncing () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); // Return it return $hasAnnounced; @@ -700,13 +700,13 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function ifNodeHasAnnouncementCompleted () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); // Return it return $hasAnnouncementCompleted; @@ -729,7 +729,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @return void */ public final function enableAcceptDhtBootstrap ($acceptDhtBootstrap = TRUE) { - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Enabling DHT bootstrap requests ...'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Enabling DHT bootstrap requests ...'); $this->acceptDhtBootstrap = $acceptDhtBootstrap; } @@ -757,7 +757,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public function determineUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Determine UNL based on this node: // 1) Get discovery class @@ -767,7 +767,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $unlInstance = $discoveryInstance->discoverUniversalNodeLocatorByNode($this); // 3) Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: unlInstance= ' . $unlInstance->__toString() . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unlInstance= ' . $unlInstance->__toString() . ' - EXIT!'); return $unlInstance; } @@ -778,7 +778,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { */ public final function getUniversalNodeLocatorArray () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Get the Universal Node Locator (UNL) instance $unlInstance = $this->determineUniversalNodeLocator(); @@ -793,7 +793,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $unlData = $unlInstance->getUnlData(); // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: EXIT!'); return $unlData; } @@ -862,7 +862,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { $dataSetInstance->addCriteria($element, $nodeData[$element]); } else { // Output warning message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in nodeData array.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: addArrayToDataSet(): Element ' . $element . ' not found in nodeData array.'); } } // END - foreac } diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index ed2e2b300..4c50578a9 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -114,7 +114,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[' . __METHOD__ . ':' . __LINE__ . ']: isInputBufferEmpty=' . intval($isInputBufferEmpty)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER: isInputBufferEmpty=' . intval($isInputBufferEmpty)); // Return it return $isInputBufferEmpty; @@ -183,7 +183,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ private function handlePackageByUnhandledPackage (array $packageContent) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ']: 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))) { @@ -191,7 +191,7 @@ 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[' . __METHOD__ . ':' . __LINE__ . ']: 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)); @@ -233,7 +233,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, */ public function handlePendingData () { // Debug output - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ']: 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()); @@ -241,8 +241,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[' . __METHOD__ . ':' . __LINE__ . ']: Pending data of ' . strlen($this->pendingData) . ' Bytes are incomplete, waiting for more ...'); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ']: 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) { /* @@ -277,7 +277,7 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, $this->clearPendingData(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-ASSEMBLER[' . __METHOD__ . ':' . __LINE__ . ']: 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) { @@ -293,7 +293,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 b74384fc3..2146fe4df 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -393,7 +393,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -428,7 +428,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ private function getHashFromContent ($content) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -441,7 +441,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: 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; @@ -502,7 +502,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -558,7 +558,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $currentRecipient = $iteratorInstance->current(); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Setting recipient to ' . $currentRecipient . ',previous=' . $packageData[self::PACKAGE_DATA_RECIPIENT]); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Setting recipient to ' . $currentRecipient . ',previous=' . $packageData[self::PACKAGE_DATA_RECIPIENT]); // Set the recipient $packageData[self::PACKAGE_DATA_RECIPIENT] = $currentRecipient; @@ -567,7 +567,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->pushNamed(self::STACKER_NAME_DECLARED, $packageData); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Package declared for recipient ' . $currentRecipient); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Package declared for recipient ' . $currentRecipient); // Skip to next entry $iteratorInstance->next(); @@ -591,6 +591,9 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * @return void */ private function deliverRawPackageData (array $packageData) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE: packageData()=%d - CALLED!', count($packageData))); + /* * This package may become big, depending on the shared object size or * delivered message size which shouldn't be so long (to save @@ -609,11 +612,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $socketInstance = $discoveryInstance->discoverSocket($packageData, BaseConnectionHelper::CONNECTION_TYPE_OUTGOING); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' after discoverSocket() has been called.'); + //* 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[' . __METHOD__ . ':' . __LINE__ . ']: stateInstance=' . $helperInstance->getStateInstance()); - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Reached line ' . __LINE__ . ' before isSocketRegistered() has been called.'); + //* 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.'); // The socket needs to be put in a special registry that can handle such data $registryInstance = SocketRegistryFactory::createSocketRegistryInstance(); @@ -633,32 +636,32 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Is it not there? if (($socketInstance->isValidSocket()) && (!$registryInstance->isSocketRegistered($infoInstance, $socketInstance))) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Registering socket ' . $socketInstance . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...'); // Then register it $registryInstance->registerSocket($infoInstance, $socketInstance, $packageData); } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) { // Is not connected, then we cannot send - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.'); // Shutdown the socket $socketInstance->shutdownSocket(); } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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.'); } /** @@ -681,7 +684,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $helperInstance = $infoInstance->getHelperInstance(); // Some sanity-checks on the object - //* DEBUG-DIE: */ die('[' . __METHOD__ . ':' . __LINE__ . ']: p1=' . $infoInstance->getProtocolName() . ',p2=' . $helperInstance->getProtocolName() . ',infoInstance=' . print_r($infoInstance, TRUE)); + //* DEBUG-DIE: */ die(': p1=' . $infoInstance->getProtocolName() . ',p2=' . $helperInstance->getProtocolName() . ',infoInstance=' . print_r($infoInstance, TRUE)); assert($helperInstance instanceof ConnectionHelper); assert($infoInstance->getProtocolName() == $helperInstance->getProtocolName()); @@ -705,12 +708,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -722,11 +725,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: hash=' . $hash . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: hash=' . $hash . ' - EXIT!'); // Return it return $hash; @@ -742,7 +745,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[' . __METHOD__ . ':' . __LINE__ . ']: 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])); @@ -753,17 +756,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: isHashValid=' . intval($isHashValid) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: isHashValid=' . intval($isHashValid) . ' - EXIT!'); return $isHashValid; } @@ -890,7 +893,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Make sure this method isn't working if there is no package enqueued if (!$this->isPackageEnqueued()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No raw package data waiting declaration, but ' . __METHOD__ . ' has been called!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: No raw package data waiting declaration, but ' . __METHOD__ . ' has been called!'); return; } // END - if @@ -921,7 +924,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Sanity check if we have packages declared if (!$this->isPackageDeclared()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No package has been declared, but ' . __METHOD__ . ' has been called!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: No package has been declared, but ' . __METHOD__ . ' has been called!'); return; } // END - if @@ -940,7 +943,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->popNamed(self::STACKER_NAME_DECLARED); } catch (UnexpectedStateException $e) { // The state is not excepected (shall be 'connected') - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Caught ' . $e->__toString() . ',message=' . $e->getMessage()); // Mark the package with status failed $this->changePackageStatus($packageData, self::STACKER_NAME_DECLARED, self::PACKAGE_STATUS_FAILED); @@ -962,7 +965,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Sanity check if we have packages waiting for delivery if (!$this->isPackageWaitingForDelivery()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No package is waiting for delivery, but ' . __METHOD__ . ' was called.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: No package is waiting for delivery, but ' . __METHOD__ . ' was called.'); return; } // END - if @@ -977,7 +980,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getStackInstance()->popNamed(self::STACKER_NAME_OUTGOING); } catch (InvalidSocketException $e) { // Output exception message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: Package was not delivered: ' . $e->getMessage()); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Package was not delivered: ' . $e->getMessage()); // Mark package as failed $this->changePackageStatus($packageData, self::STACKER_NAME_OUTGOING, self::PACKAGE_STATUS_FAILED); @@ -1009,14 +1012,14 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R assert(is_resource($encodedDataArray[self::RAW_SOCKET_INDEX])); // And deliver it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Sending out ' . strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) . ' bytes,rawBufferSize=' . $encodedDataArray[self::RAW_BUFFER_SIZE_INDEX] . ',diff=' . $encodedDataArray[self::RAW_DIFF_INDEX]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Sending out ' . strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) . ' bytes,rawBufferSize=' . $encodedDataArray[self::RAW_BUFFER_SIZE_INDEX] . ',diff=' . $encodedDataArray[self::RAW_DIFF_INDEX]); if ($encodedDataArray[self::RAW_DIFF_INDEX] >= 0) { // Send all out (encodedData is smaller than or equal buffer size) - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: MD5=' . md5(substr($encodedDataArray[self::RAW_ENCODED_DATA_INDEX], 0, ($encodedDataArray[self::RAW_BUFFER_SIZE_INDEX] - $encodedDataArray[self::RAW_DIFF_INDEX])))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: MD5=' . md5(substr($encodedDataArray[self::RAW_ENCODED_DATA_INDEX], 0, ($encodedDataArray[self::RAW_BUFFER_SIZE_INDEX] - $encodedDataArray[self::RAW_DIFF_INDEX])))); $sentBytes = @socket_write($encodedDataArray[self::RAW_SOCKET_INDEX], $encodedDataArray[self::RAW_ENCODED_DATA_INDEX], ($encodedDataArray[self::RAW_BUFFER_SIZE_INDEX] - $encodedDataArray[self::RAW_DIFF_INDEX])); } else { // Send buffer size out - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: MD5=' . md5(substr($encodedDataArray[self::RAW_ENCODED_DATA_INDEX], 0, $encodedDataArray[self::RAW_BUFFER_SIZE_INDEX]))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: MD5=' . md5(substr($encodedDataArray[self::RAW_ENCODED_DATA_INDEX], 0, $encodedDataArray[self::RAW_BUFFER_SIZE_INDEX]))); $sentBytes = @socket_write($encodedDataArray[self::RAW_SOCKET_INDEX], $encodedDataArray[self::RAW_ENCODED_DATA_INDEX], $encodedDataArray[self::RAW_BUFFER_SIZE_INDEX]); } @@ -1029,7 +1032,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R throw new InvalidSocketException(array($this, $encodedDataArray[self::RAW_SOCKET_INDEX], $socketError, $errorMessage), SocketHandler::EXCEPTION_INVALID_SOCKET); } elseif (($sentBytes === 0) && (strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) > 0)) { // Nothing sent means we are done - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: All sent! (LINE=' . __LINE__ . ')'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; } else { // The difference between sent bytes and length of raw data should not go below zero @@ -1039,7 +1042,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $encodedDataArray[self::RAW_SENT_BYTES_INDEX] += $sentBytes; // Cut out the last unsent bytes - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Sent out ' . $sentBytes . ' of ' . strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) . ' bytes ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Sent out ' . $sentBytes . ' of ' . strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) . ' bytes ...'); $encodedDataArray[self::RAW_ENCODED_DATA_INDEX] = substr($encodedDataArray[self::RAW_ENCODED_DATA_INDEX], $sentBytes); // Calculate difference again @@ -1048,7 +1051,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R // Can we abort? if (strlen($encodedDataArray[self::RAW_ENCODED_DATA_INDEX]) <= 0) { // Abort here, all sent! - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: All sent! (LINE=' . __LINE__ . ')'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: All sent! (LINE=' . __LINE__ . ')'); return; } // END - if } @@ -1107,12 +1110,12 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R */ if (!$this->isRawDataPending()) { // This is not fatal but should be avoided - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: No raw (decoded?) data is pending, but ' . __METHOD__ . ' has been called!'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: No raw (decoded?) data is pending, but ' . __METHOD__ . ' has been called!'); return; } // END - if // Very noisy debug message: - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -1128,7 +1131,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[' . __METHOD__ . ':' . __LINE__ . ']: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . BaseRawDataHandler::SOCKET_ERROR_UNHANDLED . ')'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: errorCode=' . $decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] . '(' . BaseRawDataHandler::SOCKET_ERROR_UNHANDLED . ')'); assert($decodedData[BaseRawDataHandler::PACKAGE_ERROR_CODE] == BaseRawDataHandler::SOCKET_ERROR_UNHANDLED); // Remove the last chunk SEPARATOR (because there is no need for it) @@ -1138,7 +1141,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); } @@ -1156,7 +1159,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -1250,7 +1253,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); } @@ -1262,7 +1265,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[' . __METHOD__ . ':' . __LINE__ . ']: ' . $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); @@ -1271,7 +1274,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->getAssemblerInstance()->accept($visitorInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); } /** @@ -1284,7 +1287,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R $this->initStacks(TRUE); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: All stacker have been re-initialized.'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: All stacker have been re-initialized.'); } /** @@ -1468,7 +1471,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[' . __METHOD__ . ':' . __LINE__ . ']: 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]); @@ -1513,7 +1516,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R unset($messageData[self::MESSAGE_ARRAY_DATA]); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE[' . __METHOD__ . ':' . __LINE__ . ']: messageData=' . print_r($messageData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: messageData=' . print_r($messageData, TRUE)); // Resolve session id ('sender' is a session id) into node id $nodeId = HubTools::resolveNodeIdBySessionId($messageData[self::MESSAGE_ARRAY_SENDER]); diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index 37d0018e1..1aee48e68 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: finalHash[' . gettype($finalHash) . ']=' . $finalHash); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: finalHash[' . gettype($finalHash) . ']=' . $finalHash); try { // Get current chunk index diff --git a/application/hub/classes/pools/class_BasePool.php b/application/hub/classes/pools/class_BasePool.php index d4ee8efac..fc62e8149 100644 --- a/application/hub/classes/pools/class_BasePool.php +++ b/application/hub/classes/pools/class_BasePool.php @@ -92,7 +92,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[' . __METHOD__ . ':' . __LINE__ . ']: 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'); @@ -107,7 +107,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[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: EXIT!'); } /** @@ -128,7 +128,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { */ public function accept (Visitor $visitorInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - CALLED!'); // Visit this pool $visitorInstance->visitPool($this); @@ -156,7 +156,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[' . __METHOD__ . ':' . __LINE__ . ']: Going to visit pooled object ' . $poolEntry->__toString() . ' with visitor ' . $visitorInstance->__toString() . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-POOL: Going to visit pooled object ' . $poolEntry->__toString() . ' with visitor ' . $visitorInstance->__toString() . ' ...'); $poolEntry->accept($visitorInstance); } else { // Cannot visit this entry @@ -168,7 +168,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { } // END - while // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: ' . $visitorInstance->__toString() . ' has visited - EXIT!'); } /** @@ -206,7 +206,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { */ public function preShutdown () { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Shutting down listener pool - CALLED!'); // Get a new visitor $visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_listener_pool_visitor_class'); @@ -215,7 +215,7 @@ abstract class BasePool extends BaseHubSystem implements Poolable, Visitable { $this->accept($visitorInstance); // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down listener pool - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Shutting down listener pool - EXIT!'); } } diff --git a/application/hub/classes/pools/listener/class_DefaultListenerPool.php b/application/hub/classes/pools/listener/class_DefaultListenerPool.php index 55f16d29c..21a82997d 100644 --- a/application/hub/classes/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/classes/pools/listener/class_DefaultListenerPool.php @@ -70,7 +70,7 @@ class DefaultListenerPool extends BasePool implements PoolableListener { // Debug message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput( - 'POOL[' . __METHOD__ . ':' . __LINE__ . ']: Listener ' . $listenerInstance->__toString() . + 'POOL: Listener ' . $listenerInstance->__toString() . ' 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 1797f0e55..c4b9143e8 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -71,6 +71,9 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { * @throws InvalidSocketException If the given socket has an error */ private function validateSocket (StorableSocket $socketInstance) { + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: socketInstance.socketResource=%s - CALLED!', $socketInstance->getSocketResource())); + // Is it a valid resource? if (!$socketInstance->isValidSocket()) { // Throw an exception @@ -97,7 +100,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -120,11 +123,11 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { } // END - if } else { // Server sockets won't work with socket_getpeername() - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Socket resource is server socket (' . $socketInstance->getSocketResource() . '). This is not a bug.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Socket resource is server socket (' . $socketInstance->getSocketResource() . '). This is not a bug.'); } // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Adding peer ' . $peerName . ',socketResource=' . $socketInstance->getSocketResource() . ',type=' . $connectionType); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Adding peer ' . $peerName . ',socketResource=' . $socketInstance->getSocketResource() . ',type=' . $connectionType); // Construct the array $socketArray = array( @@ -228,7 +231,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { assert(isset($unlData[UniversalNodeLocator::UNL_PART_PORT])); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Checking ' . count($this->getAllSockets()) . ' socket(s),unlData[' . UniversalNodeLocator::UNL_PART_ADDRESS . ']=' . $unlData[UniversalNodeLocator::UNL_PART_ADDRESS] . ',unlData[' . UniversalNodeLocator::UNL_PART_PORT . ']=' . $unlData[UniversalNodeLocator::UNL_PART_PORT] . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Checking ' . count($this->getAllSockets()) . ' socket(s),unlData[' . UniversalNodeLocator::UNL_PART_ADDRESS . ']=' . $unlData[UniversalNodeLocator::UNL_PART_ADDRESS] . ',unlData[' . UniversalNodeLocator::UNL_PART_PORT . ']=' . $unlData[UniversalNodeLocator::UNL_PART_PORT] . ' ...'); // Default is all sockets $sockets = $this->getAllSockets(); @@ -247,7 +250,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { // Is this a server socket? if ($socketArray[self::SOCKET_ARRAY_INSTANCE]->equals($this->getListenerInstance()->getSocketInstance())) { // Skip 'server' sockets (local socket) - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: Skipping server socket ' . $socketArray[self::SOCKET_ARRAY_INSTANCE]->getSocketResource() . ' ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: Skipping server socket ' . $socketArray[self::SOCKET_ARRAY_INSTANCE]->getSocketResource() . ' ...'); continue; } // END - if @@ -264,13 +267,13 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { $socketInstance = $socketArray[self::SOCKET_ARRAY_INSTANCE]; // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: peerName=' . $peerName . ' matches with recipient IP address. Taking socket=' . $socketArray[self::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[self::SOCKET_ARRAY_CONN_TYPE]); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: peerName=' . $peerName . ' matches with recipient IP address. Taking socket=' . $socketArray[self::SOCKET_ARRAY_INSTANCE] . ',type=' . $socketArray[self::SOCKET_ARRAY_CONN_TYPE]); break; } // END - if } // END - foreach // Return the determined socket resource - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('POOL: socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource()); return $socketInstance; } diff --git a/application/hub/classes/recipient/class_ b/application/hub/classes/recipient/class_ index 2c92c5595..605e663dc 100644 --- a/application/hub/classes/recipient/class_ +++ b/application/hub/classes/recipient/class_ @@ -63,7 +63,7 @@ class ???Recipient extends BaseRecipient implements Recipient { */ public function resolveRecipient ($recipient, Listable $listInstance) { // Make sure the recipient is valid - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->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 09b161c35..f6c527143 100644 --- a/application/hub/classes/recipient/dht/class_DhtRecipient.php +++ b/application/hub/classes/recipient/dht/class_DhtRecipient.php @@ -69,7 +69,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -91,12 +91,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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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 754742f1a..18b48dc1b 100644 --- a/application/hub/classes/recipient/direct/class_DirectRecipient.php +++ b/application/hub/classes/recipient/direct/class_DirectRecipient.php @@ -67,7 +67,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 ea924a1d5..e942b4dd1 100644 --- a/application/hub/classes/recipient/self/class_SelfRecipient.php +++ b/application/hub/classes/recipient/self/class_SelfRecipient.php @@ -67,7 +67,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 5fd5db3d9..0047f3704 100644 --- a/application/hub/classes/recipient/upper/class_UpperRecipient.php +++ b/application/hub/classes/recipient/upper/class_UpperRecipient.php @@ -75,14 +75,14 @@ class UpperRecipient extends BaseRecipient implements Recipient { // Is maximum reached? if ($listInstance->count() == $this->getConfigInstance()->getConfigEntry('package_recipient_max_count')) { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-RESOLVER[' . __METHOD__ . ':' . __LINE__ . ']: Going to abort at maximum of ' . $this->getConfigInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-RESOLVER: Going to abort at maximum of ' . $this->getConfigInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!'); // Then stop adding more break; } // END - if // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-RESOLVER[' . __METHOD__ . ':' . __LINE__ . ']: Adding node ' . print_r($unlData, TRUE) . ' as recipient.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RECIPIENT-RESOLVER: Adding node ' . print_r($unlData, TRUE) . ' as recipient.'); // Add the entry $listInstance->addEntry('unl', $unlData); diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index d5d6079ca..c9a44967a 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -83,14 +83,14 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function getSubRegistryKey (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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', @@ -101,7 +101,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); // Return resulting key return $key; @@ -115,13 +115,13 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function getRegistryKeyFromInfo (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ' - EXIT!'); // Return resulting key return $key; @@ -135,7 +135,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ private function isInfoRegistered (ShareableInfo $infoInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:info=' . $infoInstance->getProtocolName() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ' - CALLED!'); // Get the key $key = $this->getRegistryKeyFromInfo($infoInstance); @@ -144,7 +144,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $isRegistered = $this->instanceExists($key); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: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; @@ -160,7 +160,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[' . __METHOD__ . ':' . __LINE__ . ']: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; @@ -171,7 +171,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $key = $this->getRegistryKeyFromInfo($infoInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -180,12 +180,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketKey = $this->getSubRegistryKey($infoInstance); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -194,12 +194,12 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $isRegistered = (($registeredInstance instanceof SocketContainer) && ($registeredInstance->equals($socketInstance))); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: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; @@ -216,7 +216,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function registerSocket (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: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)) { @@ -240,7 +240,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[' . __METHOD__ . ':' . __LINE__ . ']: 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); } @@ -253,7 +253,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke */ public function getRegisteredSocketResource (Listenable $listenerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:listener=' . $listenerInstance->getConnectionType() . ' - CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getConnectionType() . ' - CALLED!'); // The socket must be registered before we can return it if (!$this->isInfoRegistered($listenerInstance)) { @@ -274,7 +274,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $socketInstance = $registryInstance->getInstance($socketKey); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:listener=' . $listenerInstance->getConnectionType() . ',socketResource[]=' . gettype($socketInstance) . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:listener=' . $listenerInstance->getConnectionType() . ',socketResource[]=' . gettype($socketInstance) . ' - EXIT!'); // Return the resource return $socketInstance; @@ -294,12 +294,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 => $containerInstance) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ',subKey=' . $subKey . ',containerInstance=' . $containerInstance->__toString()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: key=' . $key . ',subKey=' . $subKey . ',containerInstance=' . $containerInstance->__toString()); // Is this a SocketContainer instance and is the address the same? if (($containerInstance instanceof SocketContainer) && ($containerInstance->ifAddressMatches($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]))) { @@ -311,7 +311,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $helperInstance = $containerInstance->getHelperInstance(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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) { @@ -328,11 +328,11 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke $infoInstance->fillWithConnectionHelperInformation($helperInstance); } else { // Not supported state! - $this->debugInstance('[' . __METHOD__ . ':' . __LINE__ . ']: Invalid state found, please report this to the developers with full debug infos.' . PHP_EOL); + $this->debugInstance(': Invalid state found, please report this to the developers with full debug infos.' . PHP_EOL); } // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: 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 ba788c18b..9a426a684 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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 0d49bcd6f..51b8e2875 100644 --- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php +++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php @@ -108,7 +108,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 [' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Is it valid? if (!$this->getDirectoryInstance()->getDirectoryIteratorInstance()->valid()) { @@ -117,16 +117,16 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R } // END - if // Read next entry - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . '] 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[' . __METHOD__ . ':' . __LINE__ . '] directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - SKIPPED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE directoryEntry(' . strlen($directoryEntry) . ')=' . $directoryEntry . ' - SKIPPED!'); return FALSE; } // END - if @@ -134,7 +134,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 [' . __METHOD__ . ':' . __LINE__ . '] 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; @@ -166,7 +166,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function saveCsvDataInCrawlerQueue (array $csvData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -183,13 +183,13 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R ); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -198,7 +198,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->enqueueInFileStack($csvArray); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -234,7 +234,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 [' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Is the instance set? if (is_null($this->lastCsvFileInstance)) { @@ -251,7 +251,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 [' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -263,7 +263,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function parseCsvFile () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : CALLED!'); // Get next entry $csvFileInstance = $this->getStackSourceInstance()->popNamed(self::STACK_NAME_CSV_FILE); @@ -272,7 +272,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $csvData = $csvFileInstance->readCsvFileLine($this->columnSeparator); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: 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)); @@ -280,7 +280,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 [' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -302,7 +302,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 [' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** @@ -312,13 +312,13 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R */ private function parseCsvEntry () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: 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 [' . __METHOD__ . ':' . __LINE__ . ']: 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); @@ -327,7 +327,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R $this->saveCsvDataInCrawlerQueue($csvData); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE [' . __METHOD__ . ':' . __LINE__ . ']: EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-SOURCE : EXIT!'); } /** diff --git a/application/hub/classes/states/communicator/class_Communicator b/application/hub/classes/states/communicator/class_Communicator index a159a1ab3..04406a0cd 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__)->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); diff --git a/application/hub/classes/states/crawler/class_Crawler b/application/hub/classes/states/crawler/class_Crawler index e1924dd1e..34f86784b 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__)->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); diff --git a/application/hub/classes/states/cruncher/class_Cruncher b/application/hub/classes/states/cruncher/class_Cruncher index 1182d6ae2..d4f17b46f 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__)->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); diff --git a/application/hub/classes/states/dht/active/class_DhtActiveState.php b/application/hub/classes/states/dht/active/class_DhtActiveState.php index a3215ade8..06aadf2b6 100644 --- a/application/hub/classes/states/dht/active/class_DhtActiveState.php +++ b/application/hub/classes/states/dht/active/class_DhtActiveState.php @@ -52,7 +52,7 @@ class DhtActiveState extends BaseDhtState implements Stateable { $stateInstance = new DhtActiveState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE[' . __METHOD__ . ':' . __LINE__ . ']: 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() . '.'); // Set the dht instance $stateInstance->setDhtInstance($dhtInstance); diff --git a/application/hub/classes/states/dht/booting/class_DhtBootingState.php b/application/hub/classes/states/dht/booting/class_DhtBootingState.php index ebb9d28c4..51f864cda 100644 --- a/application/hub/classes/states/dht/booting/class_DhtBootingState.php +++ b/application/hub/classes/states/dht/booting/class_DhtBootingState.php @@ -55,7 +55,7 @@ class DhtBootingState extends BaseDhtState implements Stateable { $stateInstance = new DhtBootingState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE[' . __METHOD__ . ':' . __LINE__ . ']: 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() . '.'); // Set the dht instance $stateInstance->setDhtInstance($dhtInstance); diff --git a/application/hub/classes/states/dht/class_Dht b/application/hub/classes/states/dht/class_Dht index d885f71ce..1d1dd6fb5 100644 --- a/application/hub/classes/states/dht/class_Dht +++ b/application/hub/classes/states/dht/class_Dht @@ -52,7 +52,7 @@ class Dht???State extends BaseDhtState implements Stateable { $stateInstance = new Dht???State(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->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() . '.'); // Set the dht instance $stateInstance->setDhtInstance($dhtInstance); diff --git a/application/hub/classes/states/dht/init/class_DhtInitState.php b/application/hub/classes/states/dht/init/class_DhtInitState.php index d0d7c9770..e08a84c9d 100644 --- a/application/hub/classes/states/dht/init/class_DhtInitState.php +++ b/application/hub/classes/states/dht/init/class_DhtInitState.php @@ -52,7 +52,7 @@ class DhtInitState extends BaseDhtState implements Stateable { $stateInstance = new DhtInitState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE[' . __METHOD__ . ':' . __LINE__ . ']: 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() . '.'); // Set the dht instance $stateInstance->setDhtInstance($dhtInstance); diff --git a/application/hub/classes/states/dht/virgin/class_DhtVirginState.php b/application/hub/classes/states/dht/virgin/class_DhtVirginState.php index 1a37f3a8f..3dc2b82e7 100644 --- a/application/hub/classes/states/dht/virgin/class_DhtVirginState.php +++ b/application/hub/classes/states/dht/virgin/class_DhtVirginState.php @@ -52,7 +52,7 @@ class DhtVirginState extends BaseDhtState implements Stateable { $stateInstance = new DhtVirginState(); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-STATE[' . __METHOD__ . ':' . __LINE__ . ']: 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() . '.'); // Set the dht instance $stateInstance->setDhtInstance($dhtInstance); diff --git a/application/hub/classes/states/miner/class_Miner b/application/hub/classes/states/miner/class_Miner index 3e6bb8594..4db5144a1 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__)->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); diff --git a/application/hub/classes/states/node/class_Node b/application/hub/classes/states/node/class_Node index bee58507e..cb2d40003 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__)->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); diff --git a/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php b/application/hub/classes/statistics/connection/class_ConnectionStatisticsHelper.php index a518ec250..7f839a6a7 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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/output/class_RawDataOutputStream.php b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php index 72bc790c1..19e67abe1 100644 --- a/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php +++ b/application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php @@ -64,9 +64,9 @@ class RawDataOutputStream extends BaseStream implements OutputStream { * [[S]] - Start marker * [[E]] - End marker */ - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: data(' . strlen($data) . ')=' . $data); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('RAW-OUTPUT-STREAM: data(' . strlen($data) . ')=' . $data); // Return it return $data; diff --git a/application/hub/classes/tags/package/class_PackageTags.php b/application/hub/classes/tags/package/class_PackageTags.php index 9cb6e22d6..1bb2d03bb 100644 --- a/application/hub/classes/tags/package/class_PackageTags.php +++ b/application/hub/classes/tags/package/class_PackageTags.php @@ -79,7 +79,7 @@ class PackageTags extends BaseTag implements Tagable { */ private function initObjectRegistry () { // Output debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: Initializing object registry - CALLED!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Initializing object registry - CALLED!'); // Get the application instance $applicationInstance = Registry::getRegistry()->getInstance('app'); @@ -97,7 +97,7 @@ class PackageTags extends BaseTag implements Tagable { $this->getTemplateInstance()->renderXmlContent(); // Output debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: Initializing object registry - EXIT!'); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Initializing object registry - EXIT!'); } /** @@ -108,7 +108,7 @@ class PackageTags extends BaseTag implements Tagable { */ private function extractTagsFromPackageData (array $packageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -137,7 +137,7 @@ class PackageTags extends BaseTag implements Tagable { // "Walk" over all tags foreach ($this->getTags() as $tag) { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: Validating tag ' . $tag . ' ...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Validating tag ' . $tag . ' ...'); // Get an array from this tag $entry = $objectRegistryInstance->getArrayFromKey(XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_NAME, $tag); diff --git a/application/hub/classes/tasks/apt-proxy/class_ b/application/hub/classes/tasks/apt-proxy/class_ index 359e40142..72f5e537d 100644 --- a/application/hub/classes/tasks/apt-proxy/class_ +++ b/application/hub/classes/tasks/apt-proxy/class_ @@ -81,7 +81,7 @@ class AptProxy???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php index 166535ca8..0d04fb3a8 100644 --- a/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php +++ b/application/hub/classes/tasks/apt-proxy/class_AptProxyListenerTask.php @@ -81,7 +81,7 @@ class AptProxyListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/chat/class_ b/application/hub/classes/tasks/chat/class_ index 596414d8e..85222be7d 100644 --- a/application/hub/classes/tasks/chat/class_ +++ b/application/hub/classes/tasks/chat/class_ @@ -81,7 +81,7 @@ class Chat???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php b/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php index 334243512..980943e01 100644 --- a/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php +++ b/application/hub/classes/tasks/chat/class_ChatTelnetListenerTask.php @@ -81,7 +81,7 @@ class ChatTelnetListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/class_Crawler b/application/hub/classes/tasks/crawler/class_Crawler index f74cd7f6a..82cf4f8e4 100644 --- a/application/hub/classes/tasks/crawler/class_Crawler +++ b/application/hub/classes/tasks/crawler/class_Crawler @@ -81,7 +81,7 @@ class Crawler???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php index 089fba082..0571b605d 100644 --- a/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php +++ b/application/hub/classes/tasks/crawler/communicator/class_CrawlerNodeCommunicatorTask.php @@ -79,7 +79,7 @@ class CrawlerNodeCommunicatorTask extends BaseTask implements Taskable, Visitabl $stateInstance = Registry::getRegistry()->getInstance('crawler')->getStateInstance(); // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 CrawlerNodeCommunicatorTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 be7022354..7659a2995 100644 --- a/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php +++ b/application/hub/classes/tasks/crawler/document_parser/class_CrawlerDocumentParserTask.php @@ -82,7 +82,7 @@ class CrawlerDocumentParserTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 8c94f162c..595aca38d 100644 --- a/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php +++ b/application/hub/classes/tasks/crawler/mime_sniffer/class_CrawlerMimeSnifferTask.php @@ -82,7 +82,7 @@ class CrawlerMimeSnifferTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php b/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php index 2d48a70ca..40a5b0671 100644 --- a/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php +++ b/application/hub/classes/tasks/crawler/ping/class_CrawlerPingTask.php @@ -82,7 +82,7 @@ class CrawlerPingTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php b/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php index 30a68c82a..11d544c9c 100644 --- a/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php +++ b/application/hub/classes/tasks/crawler/publisher/class_CrawlerRemoteJobPublisherTask.php @@ -82,7 +82,7 @@ class CrawlerRemoteJobPublisherTask extends BaseTask implements Taskable, Visita * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/scanner/class_Crawler b/application/hub/classes/tasks/crawler/scanner/class_Crawler index 1ac90736e..c01727e32 100644 --- a/application/hub/classes/tasks/crawler/scanner/class_Crawler +++ b/application/hub/classes/tasks/crawler/scanner/class_Crawler @@ -82,7 +82,7 @@ class Crawler???ScannerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 be45c2aa2..62f98244e 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 @@ -85,7 +85,7 @@ class CrawlerUploadedListScannerTask extends BaseTask implements Taskable, Visit * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 33e64b140..4b94b73f2 100644 --- a/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php +++ b/application/hub/classes/tasks/crawler/snippet_extractor/class_CrawlerSnippetExtractorTask.php @@ -82,7 +82,7 @@ class CrawlerSnippetExtractorTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 9b12fb952..8d07b9882 100644 --- a/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php +++ b/application/hub/classes/tasks/crawler/structure_analyzer/class_CrawlerStructureAnalyzerTask.php @@ -82,7 +82,7 @@ class CrawlerStructureAnalyzerTask extends BaseTask implements Taskable, Visitab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 2980e5110..f558357db 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 @@ -82,7 +82,7 @@ class CrawlerLocalUrlCrawlerTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 971ee8823..fe193bbd3 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 @@ -82,7 +82,7 @@ class CrawlerRemoteUrlCrawlerTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource index f31e86442..c038eac31 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSource @@ -94,7 +94,7 @@ class CrawlerUrlSource???Task extends BaseUrlSourceTask implements Taskable, Vis * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 a588520de..beda4f4b4 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceFoundRssTask.php @@ -94,7 +94,7 @@ class CrawlerUrlSourceFoundRssTask extends BaseUrlSourceTask implements Taskable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 8063ab34b..ea52e9b1e 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceLocalStartTask.php @@ -94,7 +94,7 @@ class CrawlerUrlSourceLocalStartTask extends BaseUrlSourceTask implements Taskab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 f9047ad71..2155c75e7 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceRssStartTask.php @@ -94,7 +94,7 @@ class CrawlerUrlSourceRssStartTask extends BaseUrlSourceTask implements Taskable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 b19f52b56..d1ddc638f 100644 --- a/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php +++ b/application/hub/classes/tasks/crawler/url_source/class_CrawlerUrlSourceUploadedListTask.php @@ -94,7 +94,7 @@ class CrawlerUrlSourceUploadedListTask extends BaseUrlSourceTask implements Task * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/cruncher/class_Cruncher b/application/hub/classes/tasks/cruncher/class_Cruncher index 33e6bc329..292c662e4 100644 --- a/application/hub/classes/tasks/cruncher/class_Cruncher +++ b/application/hub/classes/tasks/cruncher/class_Cruncher @@ -81,7 +81,7 @@ class Cruncher???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php b/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php index 56f27c00e..ae92f9d3f 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherKeyProducerTask.php @@ -77,7 +77,7 @@ class CruncherKeyProducerTask extends BaseTask implements Taskable, Visitable { $stateInstance = Registry::getRegistry()->getInstance('cruncher')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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); @@ -90,7 +90,7 @@ class CruncherKeyProducerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php b/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php index f9d1f599e..5d08dd889 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherTestUnitProducerTask.php @@ -77,7 +77,7 @@ class CruncherTestUnitProducerTask extends BaseTask implements Taskable, Visitab $stateInstance = Registry::getRegistry()->getInstance('cruncher')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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); @@ -90,7 +90,7 @@ class CruncherTestUnitProducerTask extends BaseTask implements Taskable, Visitab * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php b/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php index 8706f9e7c..e133edad1 100644 --- a/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php +++ b/application/hub/classes/tasks/cruncher/class_CruncherWorkUnitFetcherTask.php @@ -91,7 +91,7 @@ class CruncherWorkUnitFetcherTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 f98df4fcb..c71baca13 100644 --- a/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php +++ b/application/hub/classes/tasks/miner/block_fetcher/class_MinerBlockFetcherTask.php @@ -91,7 +91,7 @@ class MinerBlockFetcherTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 b69435864..8ba51204f 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerRealGenesisBlockProducerTask.php @@ -78,7 +78,7 @@ class MinerRealGenesisBlockProducerTask extends BaseTask implements Taskable, Vi $stateInstance = Registry::getRegistry()->getInstance('miner')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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,7 +91,7 @@ class MinerRealGenesisBlockProducerTask extends BaseTask implements Taskable, Vi * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 b58e1af54..11857f82c 100644 --- a/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php +++ b/application/hub/classes/tasks/miner/block_producer/class_MinerTestGenesisBlockProducerTask.php @@ -77,7 +77,7 @@ class MinerTestGenesisBlockProducerTask extends BaseTask implements Taskable, Vi $stateInstance = Registry::getRegistry()->getInstance('miner')->getStateInstance(); // Debug message - //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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); @@ -90,7 +90,7 @@ class MinerTestGenesisBlockProducerTask extends BaseTask implements Taskable, Vi * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/miner/class_Miner b/application/hub/classes/tasks/miner/class_Miner index e6ee87bd4..bf8435f99 100644 --- a/application/hub/classes/tasks/miner/class_Miner +++ b/application/hub/classes/tasks/miner/class_Miner @@ -81,7 +81,7 @@ class Miner???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php b/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php index 670c37cdf..abd062e67 100644 --- a/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php +++ b/application/hub/classes/tasks/miner/communicator/class_MinerNodeCommunicatorTask.php @@ -78,7 +78,7 @@ class MinerNodeCommunicatorTask extends BaseTask implements Taskable, Visitable $stateInstance = $communicatorInstance->getStateInstance(); // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Executing stateInstance=' . $stateInstance->__toString()); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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); @@ -91,7 +91,7 @@ class MinerNodeCommunicatorTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/network/class_NetworkPackage b/application/hub/classes/tasks/network/class_NetworkPackage index 1c368c03b..e53392538 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackage +++ b/application/hub/classes/tasks/network/class_NetworkPackage @@ -81,7 +81,7 @@ class NetworkPackage???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php index 9b2841e4c..a76372b22 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php +++ b/application/hub/classes/tasks/network/class_NetworkPackageReaderTask.php @@ -119,7 +119,7 @@ class NetworkPackageReaderTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php b/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php index 8a48f5c49..682c4265a 100644 --- a/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php +++ b/application/hub/classes/tasks/network/class_NetworkPackageWriterTask.php @@ -97,7 +97,7 @@ class NetworkPackageWriterTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 e57db6634..b6bd30e9c 100644 --- a/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php +++ b/application/hub/classes/tasks/node/announcement/class_NodeAnnouncementTask.php @@ -84,7 +84,7 @@ class NodeAnnouncementTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php b/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php index b55e7d809..227c86022 100644 --- a/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php +++ b/application/hub/classes/tasks/node/chunks/class_NodeChunkAssemblerTask.php @@ -116,7 +116,7 @@ class NodeChunkAssemblerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/class_Node b/application/hub/classes/tasks/node/class_Node index 1780f1fc2..c5aa07418 100644 --- a/application/hub/classes/tasks/node/class_Node +++ b/application/hub/classes/tasks/node/class_Node @@ -82,7 +82,7 @@ class Node???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php b/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php index ccd5a0b27..2316e1b8a 100644 --- a/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php +++ b/application/hub/classes/tasks/node/decoder/class_NodePackageDecoderTask.php @@ -90,7 +90,7 @@ class NodePackageDecoderTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDht b/application/hub/classes/tasks/node/dht/class_NodeDht index 0a927d94e..056258b60 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDht +++ b/application/hub/classes/tasks/node/dht/class_NodeDht @@ -81,7 +81,7 @@ class NodeDht???Task extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php b/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php index 8eedbc4d8..ef5454fc3 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtBootstrapTask.php @@ -90,7 +90,7 @@ class NodeDhtBootstrapTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 d85a01dce..75fee0c49 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtInitializationTask.php @@ -90,7 +90,7 @@ class NodeDhtInitializationTask extends BaseTask implements Taskable, Visitable * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 0d1db0a9b..cd834327e 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtLateBootstrapTask.php @@ -90,7 +90,7 @@ class NodeDhtLateBootstrapTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 969d16e10..06dc58994 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationCheckTask.php @@ -97,7 +97,7 @@ class NodeDhtPublicationCheckTask extends BaseTask implements Taskable, Visitabl * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 f7a67adc5..3d44ac79a 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtPublicationTask.php @@ -97,7 +97,7 @@ class NodeDhtPublicationTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 d1a51b4fd..b88a04d46 100644 --- a/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php +++ b/application/hub/classes/tasks/node/dht/class_NodeDhtQueryTask.php @@ -97,7 +97,7 @@ class NodeDhtQueryTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('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 288fa816b..adc9d10e4 100644 --- a/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php +++ b/application/hub/classes/tasks/node/listener/class_NodeSocketListenerTask.php @@ -67,7 +67,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[' . __METHOD__ . ':' . __LINE__ . ']: 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 @@ -91,7 +91,7 @@ class NodeSocketListenerTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/ping/class_NodePingTask.php b/application/hub/classes/tasks/node/ping/class_NodePingTask.php index 171eafb03..51fac6673 100644 --- a/application/hub/classes/tasks/node/ping/class_NodePingTask.php +++ b/application/hub/classes/tasks/node/ping/class_NodePingTask.php @@ -93,7 +93,7 @@ class NodePingTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } 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 75a098280..5b1db69fe 100644 --- a/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php +++ b/application/hub/classes/tasks/node/self_connect/class_NodeSelfConnectTask.php @@ -84,7 +84,7 @@ class NodeSelfConnectTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php b/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php index b36cf79aa..b1c2c88e7 100644 --- a/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php +++ b/application/hub/classes/tasks/node/tags/class_NodePackageTagsInitTask.php @@ -82,7 +82,7 @@ class NodePackageTagsInitTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php b/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php index 191778b6e..8b84b96ea 100644 --- a/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php +++ b/application/hub/classes/tasks/node/update/class_NodeUpdateCheckTask.php @@ -81,7 +81,7 @@ class NodeUpdateCheckTask extends BaseTask implements Taskable, Visitable { * @todo 0% done */ public function doShutdown () { - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK: Shutting down...'); } } diff --git a/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php b/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php index facd95f78..6f5081948 100644 --- a/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php +++ b/application/hub/classes/template/objects/class_XmlObjectRegistryTemplateEngine.php @@ -112,7 +112,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C // Is the node name self::OBJECT_TYPE_DATA_NAME? if ($nodeName == self::OBJECT_TYPE_DATA_NAME) { // Output debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS[' . __METHOD__ . ':' . __LINE__ . ']: Adding object type ' . $characters . ' to registry.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TAGS: Adding object type ' . $characters . ' to registry.'); } // END - if // Add it to the registry diff --git a/application/hub/classes/tools/class_HubTools.php b/application/hub/classes/tools/class_HubTools.php index 2c72f0a2a..5f4d5023d 100644 --- a/application/hub/classes/tools/class_HubTools.php +++ b/application/hub/classes/tools/class_HubTools.php @@ -146,7 +146,7 @@ class HubTools extends BaseHubSystem { $nodeData = $selfInstance->getDhtInstance()->findNodeLocalBySessionId($sessionId); // Make sure the node id is there - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: sessionId=' . $sessionId . ', nodeData[' . gettype($nodeData) . ']=' . print_r($nodeData, TRUE)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: sessionId=' . $sessionId . ', nodeData[' . gettype($nodeData) . ']=' . print_r($nodeData, TRUE)); assert(isset($nodeData[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_NODE_ID])); // Return it @@ -191,25 +191,25 @@ class HubTools extends BaseHubSystem { if (preg_match('/([a-z0-9]{3,10})\/\/:([a-z0-9\.]{5,})/', $address)) { // @TODO ((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])):([0-9]{3,5}) // Direct Universal Node Locator found - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Direct Universal Node Locator ' . $address . ' detected.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Direct Universal Node Locator ' . $address . ' detected.'); } elseif (isset($selfInstance->sessionIdCache[$address])) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Using entry from sessionIdCache[] array.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Using entry from sessionIdCache[] array.'); // Found in cache! $recipient = $selfInstance->sessionIdCache[$address]; // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: sessionIdCache[' . $address . ']=' . $recipient); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: sessionIdCache[' . $address . ']=' . $recipient); } elseif (preg_match('/([a-f0-9]{' . $selfInstance->getSessionIdLength() . '})/', $address)) { // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Using internal session id resolver.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Using internal session id resolver.'); // Resolve session id into an instance of a LocateableNode class $recipient = $selfInstance->resolveUniversalNodeLocatorBySessionId($address); // Debug message - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Session id ' . $address . ' resolved to ' . $recipient); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Session id ' . $address . ' resolved to ' . $recipient); } else { // Invalid session id/UNL throw new InvalidSessionIdException($address, self::EXCEPTION_SESSION_ID_IS_INVALID); @@ -245,31 +245,31 @@ class HubTools extends BaseHubSystem { */ public static function determineOwnInternalAddress () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: 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[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $unl . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $unl . ' - EXIT!'); // Return it return $unl; @@ -282,7 +282,7 @@ class HubTools extends BaseHubSystem { */ public static function determineInternalUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is there cache? (This shortens a lot calls) if (!isset($GLOBALS[__METHOD__])) { @@ -299,7 +299,7 @@ class HubTools extends BaseHubSystem { } // END - if // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); return $GLOBALS[__METHOD__]; } @@ -310,7 +310,7 @@ class HubTools extends BaseHubSystem { */ public static function determineExternalUniversalNodeLocator () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); // Is there cache? (This shortens a lot calls) if (!isset($GLOBALS[__METHOD__])) { @@ -327,7 +327,7 @@ class HubTools extends BaseHubSystem { } // END - if // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!'); return $GLOBALS[__METHOD__]; } diff --git a/application/hub/interfaces/container/socket/class_StorableSocket.php b/application/hub/interfaces/container/socket/class_StorableSocket.php index ed5eff206..6fe915504 100644 --- a/application/hub/interfaces/container/socket/class_StorableSocket.php +++ b/application/hub/interfaces/container/socket/class_StorableSocket.php @@ -68,4 +68,11 @@ interface StorableSocket extends FrameworkInterface { */ function halfShutdownSocket (); + /** + * Validates stored stocket + * + * @return $isValidSocket Whether the stored socket is valid + */ + function isValidSocket (); + } diff --git a/core b/core index 6e44f1682..d9d2b0266 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 6e44f1682ebbdc9fc64463544e647a9c1d4dd817 +Subproject commit d9d2b0266fc21f4664087a8488d05c6d6068073b