From 0784b7b5f7b19bca4eab7ff43ff672add2c1d1f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 3 Dec 2020 23:39:34 +0100 Subject: [PATCH] Continued: - renamed more $packageInstance to $handlerInstance when it is type of Receivable - fixed handling of repeated node_data record creation - removed bad 'invalid' default values - updated core framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../chains/class_PackageFilterChain.php | 14 +- ...deDistributedHashTableDatabaseFrontend.php | 4 +- .../class_NodeInformationDatabaseFrontend.php | 5 +- .../class_PeerStateLookupDatabaseFrontend.php | 2 +- application/hub/classes/dht/class_BaseDht.php | 5 +- .../classes/dht/node/class_NodeDhtFacade.php | 19 +- .../class_PackageAssemblerFactory.php | 4 +- ...ass_PackageAnnouncementAnswerTagFilter.php | 10 +- ...ass_PackageDhtBootstrapAnswerTagFilter.php | 10 +- ..._PackageRequestNodeListAnswerTagFilter.php | 10 +- .../class_PackageAnnouncementTagFilter.php | 10 +- .../class_PackageDhtBootstrapTagFilter.php | 10 +- .../class_PackageRequestNodeListTagFilter.php | 10 +- .../class_PackageSelfConnectTagFilter.php | 10 +- ...lass_NodeAnnouncementAnswerOkayHandler.php | 6 +- ...class_RequestNodeListAnswerOkayHandler.php | 6 +- .../class_NodeMessageAnnouncementHandler.php | 6 +- ...s_NodeMessageDhtBootstrapAnswerHandler.php | 4 +- ...odeMessageRequestNodeListAnswerHandler.php | 6 +- .../class_BaseMessageHandler.php | 6 +- .../class_NodeMessageDhtBootstrapHandler.php | 6 +- ...lass_NodeMessageRequestNodeListHandler.php | 6 +- .../class_NodeMessageSelfConnectHandler.php | 4 +- .../package/class_NetworkPackageHandler.php | 11 +- .../hub/classes/nodes/class_BaseHubNode.php | 169 +++++++++++------- .../assembler/class_PackageAssembler.php | 6 +- .../tcp/class_TcpProtocolResolver.php | 2 +- .../hub/classes/tools/hub/class_HubTools.php | 2 +- .../filter/class_FilterablePackage.php | 8 +- .../class_HandleableAnswerStatus.php | 4 +- .../message-types/class_HandleableMessage.php | 8 +- .../hub/interfaces/nodes/class_Node.php | 4 +- core | 2 +- 33 files changed, 226 insertions(+), 163 deletions(-) diff --git a/application/hub/classes/chains/class_PackageFilterChain.php b/application/hub/classes/chains/class_PackageFilterChain.php index 6b02d776b..29e2c3429 100644 --- a/application/hub/classes/chains/class_PackageFilterChain.php +++ b/application/hub/classes/chains/class_PackageFilterChain.php @@ -63,12 +63,12 @@ class PackageFilterChain extends FilterChain { * @return void * @todo This may be slow if a message with a lot tags arrived */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get all filters and "run" them foreach ($this->getFilters() as $filterInstance) { // Try to process it try { - $filterInstance->processMessage($messageInstance, $packageInstance); + $filterInstance->processMessage($messageInstance, $handlerInstance); } catch (FilterChainException $e) { // This exception can be thrown to just skip any further processing self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage()); @@ -81,15 +81,15 @@ class PackageFilterChain extends FilterChain { * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Get all filters and "run" them foreach ($this->getPostFilters() as $filterInstance) { // Try to process it try { - $filterInstance->postProcessMessage($packageInstance); + $filterInstance->postProcessMessage($handlerInstance); } catch (FilterChainException $e) { // This exception can be thrown to just skip any further processing self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage()); @@ -97,7 +97,5 @@ class PackageFilterChain extends FilterChain { } } // END - foreach } -} -// [EOF] -?> +} diff --git a/application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php b/application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php index bf910e173..b3ddc7baf 100644 --- a/application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php +++ b/application/hub/classes/database/frontend/node_dht/class_NodeDistributedHashTableDatabaseFrontend.php @@ -112,7 +112,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i */ public static final function getAllElements () { // Create array and ... - $elements = array( + $elements = [ self::DB_COLUMN_NODE_ID, self::DB_COLUMN_SESSION_ID, self::DB_COLUMN_EXTERNAL_ADDRESS, @@ -120,7 +120,7 @@ class NodeDistributedHashTableDatabaseFrontend extends BaseHubDatabaseFrontend i self::DB_COLUMN_NODE_MODE, self::DB_COLUMN_ACCEPTED_OBJECTS, self::DB_COLUMN_NODE_LIST - ); + ]; // ... return it return $elements; diff --git a/application/hub/classes/database/frontend/node_information/class_NodeInformationDatabaseFrontend.php b/application/hub/classes/database/frontend/node_information/class_NodeInformationDatabaseFrontend.php index 9b971a687..a4c8d6582 100644 --- a/application/hub/classes/database/frontend/node_information/class_NodeInformationDatabaseFrontend.php +++ b/application/hub/classes/database/frontend/node_information/class_NodeInformationDatabaseFrontend.php @@ -82,6 +82,7 @@ class NodeInformationDatabaseFrontend extends BaseHubDatabaseFrontend implements */ public function findFirstNodeData () { // Is there cache? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FRONTEND: CALLED!'); if (!isset($GLOBALS[__METHOD__])) { // Now get a search criteria instance $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -95,10 +96,12 @@ class NodeInformationDatabaseFrontend extends BaseHubDatabaseFrontend implements $resultInstance = $this->doSelectByCriteria($searchInstance); // Is it valid? - $GLOBALS[__METHOD__] = ($resultInstance->next() ? $resultInstance : NULL); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FRONTEND: resultInstance->valid()=%d', intval($resultInstance->valid()))); + $GLOBALS[__METHOD__] = ($resultInstance->valid() ? $resultInstance : NULL); } // Return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FRONTEND: resultInstance[]=%s - EXIT!', gettype($GLOBALS[__METHOD__]))); return $GLOBALS[__METHOD__]; } diff --git a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseFrontend.php b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseFrontend.php index 27e3c9197..f059e94e6 100644 --- a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseFrontend.php +++ b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseFrontend.php @@ -250,7 +250,7 @@ class PeerStateLookupDatabaseFrontend extends BaseHubDatabaseFrontend implements $resultInstance = $this->doSelectByCriteria($searchInstance); // Do we have an entry? This should always the case - if (!$resultInstance->next()) { + if (!$resultInstance->valid()) { // No next record! throw new UnexpectedValueException(sprintf('resultInstance=%s,count()=%d has no next entry', $resultInstance->__toString(), $resultInstance->count())); } diff --git a/application/hub/classes/dht/class_BaseDht.php b/application/hub/classes/dht/class_BaseDht.php index 9a6345995..e3a6f01e5 100644 --- a/application/hub/classes/dht/class_BaseDht.php +++ b/application/hub/classes/dht/class_BaseDht.php @@ -183,7 +183,7 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { } // "Walk" through all entries - while ($resultInstance->next()) { + while ($resultInstance->valid()) { // Get current entry $current = $resultInstance->current(); @@ -194,6 +194,9 @@ abstract class BaseDht extends BaseHubSystem implements Distributable { // ... and push it to the next stack /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: Pushing entry with ' . count($current) . ' elements to stack ' . self::STACKER_NAME_PENDING_PUBLISHING . ' ...'); $this->getStackInstance()->pushNamed(self::STACKER_NAME_PENDING_PUBLISHING, $current); + + // Advanced to next entry + $resultInstance->next(); } // Trace message diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index 3a51a3a46..c44e1159a 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -192,7 +192,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert($resultInstance instanceof SearchableResult); // Is the next entry valid? - if (($resultInstance->valid()) && ($resultInstance->next())) { + if ($resultInstance->valid()) { /* * Then load the first entry (more entries are being ignored and * should not happen). @@ -226,7 +226,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { assert($resultInstance instanceof SearchableResult); // Is the next entry valid? - if (($resultInstance->valid()) && ($resultInstance->next())) { + if ($resultInstance->valid()) { /* * Then load the first entry (more entries are being ignored and * should not happen). @@ -353,7 +353,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { $nodeList = []; // Get node list - while ($resultInstance->next()) { + while ($resultInstance->valid()) { // Get current element (it should be an array, and have at least 1 entry) $current = $resultInstance->current(); assert(is_array($current)); @@ -367,6 +367,9 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { // Add this entry array_push($nodeList, $current); + + // Advanced to next entry + $resultInstance->next(); } // Save last exception @@ -431,13 +434,16 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { $recipients = []; // Search for all recipients - while ($resultInstance->next()) { + while ($resultInstance->valid()) { // Get current entry $current = $resultInstance->current(); // Add instance to recipient list /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: current=%s', print_r($current, TRUE))); array_push($recipients, $current); + + // Advanced to next entry + $resultInstance->next(); } // Return filled array @@ -480,13 +486,16 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { $recipients = []; // "Walk" through all entries - while ($resultInstance->next()) { + while ($resultInstance->valid()) { // Get current entry $current = $resultInstance->current(); // Add instance to recipient list /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: current=%s', print_r($current, TRUE))); array_push($recipients, $current); + + // Advanced to next entry + $resultInstance->next(); } // Return filled array diff --git a/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php b/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php index ff6fc5e9b..3b3a46d7e 100644 --- a/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php +++ b/application/hub/classes/factories/package/assembler/class_PackageAssemblerFactory.php @@ -50,14 +50,14 @@ class PackageAssemblerFactory extends ObjectFactory { * @param $packageInstance An instance of a Receivable instance * @return $assemblerInstance An instance of a Assembler instance */ - public static final function createAssemblerInstance (Receivable $packageInstance) { + public static final function createAssemblerInstance (Receivable $handlerInstance) { // If there is no assembler? if (GenericRegistry::getRegistry()->instanceExists('package_assembler')) { // Get assembler from registry $assemblerInstance = GenericRegistry::getRegistry()->getInstance('package_assembler'); } else { // Get the assembler instance - $assemblerInstance = self::createObjectByConfiguredName('package_assembler_class', array($packageInstance)); + $assemblerInstance = self::createObjectByConfiguredName('package_assembler_class', array($handlerInstance)); // Add it to the registry GenericRegistry::getRegistry()->addInstance('package_assembler', $assemblerInstance); diff --git a/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php index 77158e470..509f40f51 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php @@ -90,23 +90,23 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte * may throw (not the method itself) several exceptions: * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process message in generic way - $this->genericProcessMessage('announcement_answer', $messageInstance, $packageInstance); + $this->genericProcessMessage('announcement_answer', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php index 0adce5231..16693c9b3 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php @@ -87,23 +87,23 @@ class PackageDhtBootstrapAnswerTagFilter extends BaseNodeFilter implements Filte * may throw (not the method itself) several exceptions: * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process message in generic way - $this->genericProcessMessage('dht_bootstrap_answer', $messageInstance, $packageInstance); + $this->genericProcessMessage('dht_bootstrap_answer', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php index cbb8932d5..d13c260cb 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php @@ -87,23 +87,23 @@ class PackageRequestNodeListAnswerTagFilter extends BaseNodeFilter implements Fi * may throw (not the method itself) several exceptions: * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process message in generic way - $this->genericProcessMessage('request_node_list_answer', $messageInstance, $packageInstance); + $this->genericProcessMessage('request_node_list_answer', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php b/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php index d832eef11..ebf86067f 100644 --- a/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php @@ -96,23 +96,23 @@ class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterableP * well-formed * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process message generic - $this->genericProcessMessage('announcement', $messageInstance, $packageInstance); + $this->genericProcessMessage('announcement', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php index 06b98f676..f8fbed98b 100644 --- a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php @@ -95,23 +95,23 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP * well-formed * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process message generic - $this->genericProcessMessage('dht_bootstrap', $messageInstance, $packageInstance); + $this->genericProcessMessage('dht_bootstrap', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php b/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php index 93525df2c..b58cd26f4 100644 --- a/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php @@ -84,23 +84,23 @@ class PackageRequestNodeListTagFilter extends BaseNodeFilter implements Filterab * Processes the given raw message content. * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process messasge generic - $this->genericProcessMessage('request_node_list', $messageInstance, $packageInstance); + $this->genericProcessMessage('request_node_list', $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php b/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php index bc373090f..829f1c0c4 100644 --- a/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php @@ -93,23 +93,23 @@ class PackageSelfConnectTagFilter extends BaseNodeFilter implements FilterablePa * well-formed * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Process generic - $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageInstance, $packageInstance); + $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageInstance, $handlerInstance); } /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws UnsupportedOperationException If this method is called, please use processMessage() instead! */ - public function postProcessMessage (Receivable $packageInstance) { + public function postProcessMessage (Receivable $handlerInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php index 21089bf56..8face5026 100644 --- a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php +++ b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php @@ -76,11 +76,11 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen * Handles given message data array * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @todo Do some more here: Handle karma, et cetera? */ - public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { /* * Query DHT and force update (which will throw an exception if the * node is not found). @@ -104,7 +104,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen $nodeInstance->getStateInstance()->nodeAnnouncementSuccessful(); // Prepare next message - $this->prepareNextMessage($messageInstance, $packageInstance); + $this->prepareNextMessage($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php b/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php index 4977bac57..c0bcab027 100644 --- a/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php +++ b/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php @@ -70,12 +70,12 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement * Handles given message data array * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws NodeSessionIdVerficationException If the provided session id is not matching * @todo Do some more here: Handle karma, et cetera? */ - public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Save node list $nodeList = json_decode(base64_decode($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST])); @@ -95,7 +95,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageInstance, $this, TRUE); // Prepare next message ("hello" message to all returned nodes) - // @TODO $this->prepareNextMessage($messageInstance, $packageInstance); + // @TODO $this->prepareNextMessage($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php index 2cfd2a8e1..f8718cde1 100644 --- a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php @@ -105,11 +105,11 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws AnnouncementNotAcceptedException If this node does not accept announcements */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -127,7 +127,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl $this->registerNodeByMessageInstance($messageInstance); // Prepare answer message to be delivered back to the other node - $this->prepareAnswerMessage($messageInstance, $packageInstance); + $this->prepareAnswerMessage($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php index 1f89332a9..587c1701e 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php @@ -103,12 +103,12 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws NoDhtBootstrapAttemptedException If this DHT has not attempted to bootstrap * @todo ~30% done */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get DHT instance $dhtInstance = DhtObjectFactory::createDhtInstance('node'); diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index dbc65a5a1..d18f99fc3 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -89,11 +89,11 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws NoRequestNodeListAttemptedException If this node has not attempted to announce itself */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -111,7 +111,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme $this->registerNodeByMessageInstance($messageInstance); // Handle the answer status element - $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $packageInstance); + $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php b/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php index 463a7c963..be36b09f6 100644 --- a/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php +++ b/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php @@ -89,15 +89,15 @@ abstract class BaseMessageHandler extends BaseDataHandler { * Posty-handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { /* * Feed hash to miner by handling over the whole array as also the * sender and tags are needed. */ - $packageInstance->feedHashToMiner($messageInstance); + $handlerInstance->feedHashToMiner($messageInstance); } } diff --git a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index 97373cff7..37fc745eb 100644 --- a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -100,11 +100,11 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws DhtBootstrapNotAcceptedException If this node does not accept DHT bootstrap requests */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Is this node accepting DHT bootstrap requests? /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); if (!NodeObjectFactory::createNodeInstance()->isAcceptingDhtBootstrap()) { @@ -118,7 +118,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl $this->registerNodeByMessageInstance($messageInstance); // Prepare answer message to be delivered back to the other node - $this->prepareAnswerMessage($messageInstance, $packageInstance); + $this->prepareAnswerMessage($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php index 936a9dea0..52b13ac86 100644 --- a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -85,11 +85,11 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @throws RequestNotAcceptedException If this node does not accept this request */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -107,7 +107,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha $this->registerNodeByMessageInstance($messageInstance); // Prepare answer message to be delivered back to the other node - $this->prepareAnswerMessage($messageInstance, $packageInstance); + $this->prepareAnswerMessage($messageInstance, $handlerInstance); } /** diff --git a/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index f7981a763..34a5bceb0 100644 --- a/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -68,10 +68,10 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * Handles data array of the message * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); diff --git a/application/hub/classes/handler/package/class_NetworkPackageHandler.php b/application/hub/classes/handler/package/class_NetworkPackageHandler.php index d10df7a57..b7e537db7 100644 --- a/application/hub/classes/handler/package/class_NetworkPackageHandler.php +++ b/application/hub/classes/handler/package/class_NetworkPackageHandler.php @@ -1041,6 +1041,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei * Sends waiting packages out for delivery * * @return void + * @throws UnexpectedValueException If $sessionId is empty */ public function sendWaitingPackage () { // Debug message @@ -1065,7 +1066,15 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei // Get session id and set it back $sessionId = HubTools::resolveSessionIdByUniversalNodeLocator($locatorInstance); - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sessionId=%s found, setting ...', $sessionId)); + + // Is it empty? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sessionId[%s]=%s', gettype($sessionId), $sessionId)); + if (empty($sessionId)) { + // HubTools was not able to resolve this + throw new UnexpectedValueException('sessionId is empty'); + } + + // Set it $packageInstance->setRecipientId($sessionId); } diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index b2e818f00..961eb1806 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -36,6 +36,10 @@ use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait; use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait; use Org\Mxchange\CoreFramework\Traits\State\StateableTrait; +// Import SPL stuff +use \InvalidArgumentException; +use \UnexpectedValueException; + /** * A general hub node class * @@ -117,22 +121,22 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC /** * Node id */ - private $nodeId = 'invalid'; + private $nodeId = ''; /** * Private key */ - private $privateKey = 'invalid'; + private $privateKey = ''; /** * Node's private-key hash */ - private $nodePrivateKeyHash = 'invalid'; + private $nodePrivateKeyHash = ''; /** * Session id */ - private $sessionId = 'invalid'; + private $sessionId = ''; /** * Protected constructor @@ -269,7 +273,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC // Stop further searching break; } - } // END - foreach + } // Return the result return $isFound; @@ -290,7 +294,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC if (NULL == $locatorInstance) { // Throw NPE throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } // END - if + } // There are 2 UNLs, internal and external. if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('allow_publish_internal_address') == 'N') { @@ -300,7 +304,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC // Non-public "internal" UNL address $GLOBALS[__METHOD__] = $locatorInstance->getInternalUnl(); } - } // END - if + } // Return it return $GLOBALS[__METHOD__]; @@ -338,17 +342,19 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function bootstrapAcquireNodeId (Requestable $requestInstance, Responseable $responseInstance) { // Find node by id + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString())); $resultInstance = $this->getFrontendInstance()->findFirstNodeData(); // Is there a node id? - /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: resultInstance[]=%s', gettype($resultInstance))); + //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE))); if ($resultInstance instanceof SearchableResult && $resultInstance->valid()) { // Get current record $nodeData = $resultInstance->current(); // Get the node id from result and set it - /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE))); - $this->setNodeId($resultInstance->getField(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID)); + //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE))); + $this->setNodeId($nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID]); // Output message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: Re-using found node-id: %s', $this->getNodeId())); @@ -368,6 +374,9 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC // Output message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: Created new node-id: %s', $this->getNodeId())); } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** @@ -377,6 +386,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function bootstrapGenerateSessionId () { // Now get a search criteria instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Search for the node number one which is hard-coded the default @@ -402,21 +412,31 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC // Change the state because the node has aquired a session id $this->getStateInstance()->nodeGeneratedSessionId(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** * Generate a private key for en-/decryption * * @return void + * @throws UnexpectedValueException If private_key_hash is "invalid" */ public function bootstrapGeneratePrivateKey () { // Find node by id + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $resultInstance = $this->getFrontendInstance()->findFirstNodeData(); // Is it valid? - if ($resultInstance->valid()) { + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: resultInstance[]=%s', gettype($resultInstance))); + //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE))); + if ($resultInstance instanceof SearchableResult && $resultInstance->valid()) { + // Get current element + $current = $resultInstance->current(); + // Is the element set? - if (is_null($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY))) { + if (is_null($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY])) { /* * Auto-generate the private key for e.g. out-dated database * "tables". This allows a smooth update for the underlaying @@ -425,8 +445,8 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC $this->generatePrivateKeyAndHash($this->getSearchInstance()); } else { // Get the node id from result and set it - $this->setPrivateKey(base64_decode($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY))); - $this->setNodePrivateKeyHash($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH)); + $this->setPrivateKey(base64_decode($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY])); + $this->setNodePrivateKeyHash($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH]); // Output message self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Re-using found private key hash: ' . $this->getNodePrivateKeyHash() . ''); @@ -438,6 +458,9 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ $this->generatePrivateKeyAndHash($this->getSearchInstance()); } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** @@ -448,29 +471,31 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function addElementsToDataSet (StoreableCriteria $criteriaInstance) { // Get request instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: criteriaInstance=%s - CALLED!', $criteriaInstance->__toString())); $requestInstance = FrameworkBootstrap::getRequestInstance(); // Add node number and type $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR , 1); $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE, $requestInstance->getRequestElement('mode')); - - // Add the node id - $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID, $this->getNodeId()); + $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID , $this->getNodeId()); // Add the session id if acquired - if ($this->getSessionId() != '') { + if (!empty($this->getSessionId())) { $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_SESSION_ID, $this->getSessionId()); - } // END - if + } // Add the private key if acquired - if ($this->getPrivateKey() != '') { - $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY, base64_encode($this->getPrivateKey())); + if (!empty($this->getPrivateKey())) { + $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY , base64_encode($this->getPrivateKey())); $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH, $this->getNodePrivateKeyHash()); - } // END - if + } // Add own external and internal addresses as UNLs $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL, HubTools::determineOwnInternalAddress()); $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL, HubTools::determineOwnExternalAddress()); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** @@ -524,10 +549,11 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function announceToUpperNodes (Taskable $taskInstance) { // Is this hub node announced? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NOCE: taskInstance=%s - CALLED!', $taskInstance->__toString())); if ($this->hubIsAnnounced === TRUE) { // Already announced! throw new NodeAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED); - } // END - if + } // Debug output self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-Announcement: START (taskInstance=' . $taskInstance->__toString(). ')'); @@ -562,7 +588,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function doSelfConnection (Taskable $taskInstance) { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')'); // Get a helper instance $helperInstance = ObjectFactory::createObjectByConfiguredName('node_self_connect_helper_class', array($this)); @@ -578,7 +604,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC $helperInstance->sendPackage($this); // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: FINISHED'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Self Connection: FINISHED'); } /** @@ -595,7 +621,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC if (($this->determineIfListenerIsActive()) && ($this->isNodeActive())) { // Shutdown them down before they can hurt anything $this->shutdownListenerPool(); - } // END - if + } // Get the controller here $controllerInstance = GenericRegistry::getRegistry()->getInstance('controller'); @@ -616,7 +642,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function initializeListenerPool () { // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: START'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Initialize listener: START'); // Get a new pool instance $this->setListenerPoolInstance(ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this))); @@ -688,7 +714,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC $this->getListenerPoolInstance()->addListener($decoratorInstance); // Debug output - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: FINISHED.'); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Initialize listener: FINISHED.'); } /** @@ -727,7 +753,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @return void */ public final function enableAcceptDhtBootstrap (bool $acceptDhtBootstrap = TRUE) { - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Enabling DHT bootstrap requests ...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Enabling DHT bootstrap requests ...'); $this->acceptDhtBootstrap = $acceptDhtBootstrap; } @@ -852,9 +878,11 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public final function isAcceptingAnnouncements () { // Check it (this node must be active and not shutdown!) + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $acceptAnnouncements = (($this->acceptAnnouncements === TRUE) && ($this->isNodeActive())); // Return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptAnnouncements=%d - EXIT!', intval($acceptAnnouncements))); return $acceptAnnouncements; } @@ -865,9 +893,11 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public final function isAcceptingDhtBootstrap () { // Check it (this node must be active and not shutdown!) + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $acceptDhtBootstrap = (($this->acceptDhtBootstrap === TRUE) && ($this->isNodeActive())); // Return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptDhtBootstrap=%d - EXIT!', intval($acceptDhtBootstrap))); return $acceptDhtBootstrap; } @@ -878,16 +908,12 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @todo Add checking if this node has been announced to the sender node */ public function ifNodeIsAnnouncing () { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): state=' . $this->getStateInstance()->getStateName()); - // Simply check the state of this node + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: state=' . $this->getStateInstance()->getStateName()); $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncingState); - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); - // Return it + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: hasAnnounced=' . intval($hasAnnounced)); return $hasAnnounced; } @@ -898,16 +924,12 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @todo Add checking if this node has been announced to the sender node */ public function ifNodeHasAnnouncementCompleted () { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); - // Simply check the state of this node + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: state=' . $this->getStateInstance()->getStateName()); $hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState); - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); - // Return it + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); return $hasAnnouncementCompleted; } @@ -922,9 +944,11 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * HubRegularNode is faster, but if e.g. HubRegularI2PNode will be * added then the next check will be TRUE. */ + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $acceptsRequest = ((!$this instanceof HubRegularNode) && (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') != self::NODE_TYPE_REGULAR)); // Return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptsRequests=%d - EXIT!', intval($hasAnnouncementCompleted))); return $acceptsRequest; } @@ -934,10 +958,8 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @return $locatorInstance An instance of a LocateableNode class for this node */ public function determineUniversalNodeLocator () { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!'); - // Is there cache? + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); if (!isset($GLOBALS[__METHOD__])) { // Determine UNL based on this node: // 1) Get discovery class @@ -945,10 +967,10 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC // 2) "Determine" it $GLOBALS[__METHOD__] = $discoveryInstance->discoverUniversalNodeLocatorByNode($this); - } // END - if + } // Return it - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: locatorInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: locatorInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!'); return $GLOBALS[__METHOD__]; } @@ -967,19 +989,23 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * Handles message answer by given data array * * @param $messageInstance An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void * @todo Handle thrown exception */ - public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance) { + public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $handlerInstance) { // Construct configuration entry for handling class' name + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: messageInstance=%s,handlerInstance=%s - CALLED!', $messageInstance->__toString(), $handlerInstance->__toString())); $classConfigEntry = strtolower($messageData[NetworkPackageHandler::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[BaseXmlAnswerTemplateEngine::ANSWER_STATUS]) . '_handler_class'; // Try to get a class - $handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry); + $statusHandlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry); // Handle it there - $handlerInstance->handleAnswerMessageData($messageInstance, $packageInstance); + $statusHandlerInstance->handleAnswerMessageData($messageInstance, $handlerInstance); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** @@ -989,12 +1015,14 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function getListFromAcceptedObjectTypes () { // Get registry instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance(); // Get all entries $objectList = $objectRegistryInstance->getEntries(XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_NAME); // ... and return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: objectList()=%d - EXIT!', count($objectList))); return $objectList; } @@ -1004,19 +1032,32 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @param $dataSetInstance An instance of a StoreableCriteria class * @param $nodeData An array with valid node data * @return void + * @throws InvalidArgumentException If $nodeData is empty */ public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $nodeData) { + // Validate parameter + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: dataSetInstance=%s,nodeData()=%d - EXIT!', $dataSetInstance->__toString(), count($nodeData))); + if (count($nodeData) == 0) { + // Throw IAE + throw new InvalidArgumentException('nodeData array is empty'); + } + // Add all data the array provides foreach (NodeDistributedHashTableDatabaseFrontend::getAllElements() as $element) { // Is the element there? + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: element=%s', $element)); if (isset($nodeData[$element])) { // Add it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: Adding element=%s ...', $element)); $dataSetInstance->addCriteria($element, $nodeData[$element]); } else { // Output warning message - /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: addArrayToDataSet(): Element ' . $element . ' not found in nodeData array.'); + /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: Element %s not found in nodeData array.', $element)); } - } // END - foreac + } + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!'); } /** @@ -1026,32 +1067,32 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC */ public function createNodeDataArray () { // Get request instance + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!'); $requestInstance = FrameworkBootstrap::getRequestInstance(); // Create array with all available data - $nodeData = array( - NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR => NULL, - NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE => $requestInstance->getRequestElement('mode'), - NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID => $this->getNodeId(), + $nodeData = [ + NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR => NULL, + NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE => $requestInstance->getRequestElement('mode'), + NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID => $this->getNodeId(), NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL => HubTools::determineOwnInternalAddress(), NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL => HubTools::determineOwnExternalAddress(), - ); + ]; // Add the session id if acquired - if ($this->getSessionId() != '') { + if (!empty($this->getSessionId())) { $nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_SESSION_ID] = $this->getSessionId(); - } // END - if + } // Add the private key if acquired - if ($this->getPrivateKey() != '') { + if (!empty($this->getPrivateKey())) { $nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY] = base64_encode($this->getPrivateKey()); $nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH] = $this->getNodePrivateKeyHash(); - } // END - if - - // Debugging: - //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE))); + } // Return it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: nodeData()=%d - EXIT!', count($nodeData))); + //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE))); return $nodeData; } diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index eb73d2cb7..f5662d608 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -91,15 +91,15 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable, /** * Creates an instance of this class * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return $assemblerInstance An instance of an Assembler class */ - public static final function createPackageAssembler (Receivable $packageInstance) { + public static final function createPackageAssembler (Receivable $handlerInstance) { // Get new instance $assemblerInstance = new PackageAssembler(); // Set package instance here - $assemblerInstance->setPackageHandlerInstance($packageInstance); + $assemblerInstance->setPackageHandlerInstance($handlerInstance); // Create an instance of a raw data input stream $streamInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_input_stream_class'); diff --git a/application/hub/classes/resolver/protocol/tcp/class_TcpProtocolResolver.php b/application/hub/classes/resolver/protocol/tcp/class_TcpProtocolResolver.php index 87fd7e207..7b2a4fdb1 100644 --- a/application/hub/classes/resolver/protocol/tcp/class_TcpProtocolResolver.php +++ b/application/hub/classes/resolver/protocol/tcp/class_TcpProtocolResolver.php @@ -84,7 +84,7 @@ class TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolv $resultInstance = $nodeInstance->getFrontendInstance()->doSelectByCriteria($searchInstance); // Is the result valid? - if ((!$resultInstance->valid()) || (!$resultInstance->next())) { + if ((!$resultInstance->valid()) || (!$resultInstance->valid())) { /* * Node not found in database, this happens on first startup. So * let's get a prepared array from the node instance. diff --git a/application/hub/classes/tools/hub/class_HubTools.php b/application/hub/classes/tools/hub/class_HubTools.php index 5f6b4af51..a4f4985ec 100644 --- a/application/hub/classes/tools/hub/class_HubTools.php +++ b/application/hub/classes/tools/hub/class_HubTools.php @@ -199,7 +199,7 @@ class HubTools extends BaseHubSystem { } // Return result - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId=%s - EXIT!', $sessionId)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId[%s]=%s - EXIT!', gettype($sessionId), $sessionId)); return $sessionId; } diff --git a/application/hub/interfaces/filter/class_FilterablePackage.php b/application/hub/interfaces/filter/class_FilterablePackage.php index fd27add69..48123bcf7 100644 --- a/application/hub/interfaces/filter/class_FilterablePackage.php +++ b/application/hub/interfaces/filter/class_FilterablePackage.php @@ -36,18 +36,18 @@ interface FilterablePackage extends Filterable { * Processes the given raw message content. * * @param $messageData Raw message data array - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance); + function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance); /** * Post-processes the stacked message. Do not call popNamed() as then no * other class can process the message. * - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function postProcessMessage (Receivable $packageInstance); + function postProcessMessage (Receivable $handlerInstance); } diff --git a/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php b/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php index 58c94f383..4232e8eb5 100644 --- a/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php +++ b/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php @@ -38,10 +38,10 @@ interface HandleableAnswerStatus extends HandleableDataSet, HubInterface { * Handles given message data array * * @param $messageData An array of message data - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); + function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance); /** * Adds all required elements from given array into data set instance diff --git a/application/hub/interfaces/handler/message-types/class_HandleableMessage.php b/application/hub/interfaces/handler/message-types/class_HandleableMessage.php index 74042102b..582edef0b 100644 --- a/application/hub/interfaces/handler/message-types/class_HandleableMessage.php +++ b/application/hub/interfaces/handler/message-types/class_HandleableMessage.php @@ -37,18 +37,18 @@ interface HandleableMessage extends HandleableDataSet, HubInterface { * Handles data array of the message * * @param $messageData An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); + function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance); /** * Posty-handles data array of the message * * @param $messageData An instance of a DeliverableMessage class - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); + function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance); } diff --git a/application/hub/interfaces/nodes/class_Node.php b/application/hub/interfaces/nodes/class_Node.php index b736abbf9..9d6af7613 100644 --- a/application/hub/interfaces/nodes/class_Node.php +++ b/application/hub/interfaces/nodes/class_Node.php @@ -169,10 +169,10 @@ interface Node extends FrameworkInterface { * Handles message answer by given data array * * @param $messageData A valid answer message data array - * @param $packageInstance An instance of a Receivable class + * @param $handlerInstance An instance of a Receivable class * @return void */ - function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance); + function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $handlerInstance); /** * "Getter" for an array of all accepted object types diff --git a/core b/core index 0a198892c..ddbb50472 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 0a198892c079422ef72d679321caad9310b417f4 +Subproject commit ddbb50472e5383629958295be9f063cf8124b41f -- 2.39.5