From: Roland Häder Date: Mon, 12 Nov 2012 17:11:14 +0000 (+0000) Subject: The old state check was still required here, so re-add it X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a7f926d517d0d0f5152e27f6e954ae0d5d8f38c4;p=hub.git The old state check was still required here, so re-add it --- diff --git a/application/hub/interfaces/helper/nodes/class_NodeHelper.php b/application/hub/interfaces/helper/nodes/class_NodeHelper.php index b19e59b12..a7379ca7e 100644 --- a/application/hub/interfaces/helper/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/helper/nodes/class_NodeHelper.php @@ -153,10 +153,17 @@ interface NodeHelper extends Helper { */ function isAcceptingAnnouncements (); + /** + * Checks whether this node has attempted to announce itself + * + * @return $hasAnnounced Whether this node has attempted to announce itself + */ + function ifNodeHasAnnounced (); + /** * Checks whether this node has attempted to announce itself and completed it * - * @return $hasAnnounced Whether this node has attempted to announce itself and completed it + * @return $hasAnnouncementCompleted Whether this node has attempted to announce itself and completed it */ function ifNodeHasAnnouncementCompleted (); 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 691f1da66..266d8c3c5 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->ifNodeHasAnnouncementCompleted()) { + if (!$nodeInstance->ifNodeHasAnnounced()) { /* * This node has never announced itself, so it doesn't expect * announcement answer messages. diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 9bea51835..8f0148813 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -723,17 +723,17 @@ class BaseHubNode extends BaseHubSystem implements Updateable { } /** - * Checks whether this node has attempted to announce itself and completed it + * Checks whether this node has attempted to announce itself * - * @return $hasAnnounced Whether this node has attempted to announce itself and completed it + * @return $hasAnnounced Whether this node has attempted to announce itself * @todo Add checking if this node has been announced to the sender node */ - public function ifNodeHasAnnouncementCompleted () { + public function ifNodeHasAnnounced () { // Debug message /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); // Simply check the state of this node - $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState); + $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncedState); // Debug message /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnounced=' . intval($hasAnnounced)); @@ -742,6 +742,26 @@ class BaseHubNode extends BaseHubSystem implements Updateable { return $hasAnnounced; } + /** + * Checks whether this node has attempted to announce itself and completed it + * + * @return $hasAnnouncementCompleted 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 ifNodeHasAnnouncementCompleted () { + // Debug message + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName()); + + // Simply check the state of this node + $hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState); + + // Debug message + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted)); + + // Return it + return $hasAnnouncementCompleted; + } + /** * Enables whether this node accepts announcements *