From: Roland Häder Date: Mon, 12 Nov 2012 17:06:00 +0000 (+0000) Subject: Better check against if the node has completed announcement X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=65082b3aeb63f25506f90e021aa3fe75ba5f29ae;p=hub.git Better check against if the node has completed announcement --- diff --git a/application/hub/interfaces/helper/nodes/class_NodeHelper.php b/application/hub/interfaces/helper/nodes/class_NodeHelper.php index d0c2aba6a..b19e59b12 100644 --- a/application/hub/interfaces/helper/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/helper/nodes/class_NodeHelper.php @@ -154,11 +154,11 @@ interface NodeHelper extends Helper { function isAcceptingAnnouncements (); /** - * Checks whether this node has attempted to announce itself + * Checks whether this node has attempted to announce itself and completed it * - * @return $hasAnnounced Whether this node has attempted to announce itself + * @return $hasAnnounced Whether this node has attempted to announce itself and completed it */ - function ifNodeHasAnnounced (); + function ifNodeHasAnnouncementCompleted (); /** * Checks wether this node is accepting node-list requests diff --git a/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php b/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php index 266d8c3c5..691f1da66 100644 --- a/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php +++ b/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php @@ -97,7 +97,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements $nodeInstance = Registry::getRegistry()->getInstance('node'); // Has this node attempted to announce itself? - if (!$nodeInstance->ifNodeHasAnnounced()) { + if (!$nodeInstance->ifNodeHasAnnouncementCompleted()) { /* * This node has never announced itself, so it doesn't expect * announcement answer messages. diff --git a/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index a5605a557..704c2487f 100644 --- a/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/main/handler/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -83,7 +83,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme $nodeInstance = Registry::getRegistry()->getInstance('node'); // Has this node attempted to announce itself? - if (!$nodeInstance->ifNodeHasAnnounced()) { + if (!$nodeInstance->ifNodeHasAnnouncementCompleted()) { /* * This node has never announced itself, so it doesn't expect * request-node-list answer messages. diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 22d7273b9..9bea51835 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -723,20 +723,20 @@ class BaseHubNode extends BaseHubSystem implements Updateable { } /** - * Checks whether this node has attempted to announce itself + * Checks whether this node has attempted to announce itself and completed it * - * @return $hasAnnounced Whether this node has attempted to announce itself + * @return $hasAnnounced Whether this node has attempted to announce itself and completed it * @todo Add checking if this node has been announced to the sender node */ - public function ifNodeHasAnnounced () { + public function ifNodeHasAnnouncementCompleted () { // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnounced(): state=' . $this->getStateInstance()->getStateName()); + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); // Simply check the state of this node - $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncedState); + $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState); // Debug message - /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnounced(): hasAnnounced=' . intval($hasAnnounced)); + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnounced=' . intval($hasAnnounced)); // Return it return $hasAnnounced;