From: Roland Haeder Date: Fri, 14 Mar 2014 20:09:22 +0000 (+0100) Subject: Some stuff needs to be renamed to match better naming: 'announced' is not true X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0061ab4550d54cb28adaa8b672ccd57ba996fc76;p=hub.git Some stuff needs to be renamed to match better naming: 'announced' is not true at this state as the node is currently trying to announce itself. So 'announcing' fits the exact state. Signed-off-by: Roland Haeder --- diff --git a/application/hub/interfaces/helper/nodes/class_NodeHelper.php b/application/hub/interfaces/helper/nodes/class_NodeHelper.php index ea990cacb..4db905e04 100644 --- a/application/hub/interfaces/helper/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/helper/nodes/class_NodeHelper.php @@ -141,7 +141,7 @@ interface NodeHelper extends Helper, AddableCriteria { * * @return $hasAnnounced Whether this node has attempted to announce itself */ - function ifNodeHasAnnounced (); + function ifNodeIsAnnouncing (); /** * Checks whether this node has attempted to announce itself and completed it 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 190ed0b92..e29b8b3fa 100644 --- a/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php +++ b/application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php @@ -96,7 +96,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements $nodeInstance = Registry::getRegistry()->getInstance('node'); // Has this node attempted to announce itself? - if (!$nodeInstance->ifNodeHasAnnounced()) { + if (!$nodeInstance->ifNodeIsAnnouncing()) { /* * This node has never announced itself, so it doesn't expect * announcement answer messages. diff --git a/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php b/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php index e387152fd..97c7c551a 100644 --- a/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php +++ b/application/hub/main/helper/node/connection/class_NodeSelfConnectHelper.php @@ -83,7 +83,7 @@ class NodeSelfConnectHelper extends BaseNodeHelper implements HelpableNode { */ public function sendPackage (NodeHelper $nodeInstance) { // Sanity check: Is the node in the approx. state? (active) - $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrAnnounced(); + $nodeInstance->getStateInstance()->validateNodeStateIsActiveOrAnnouncing(); // Compile the template, this inserts the loaded node data into the gaps. $this->getTemplateInstance()->compileTemplate(); diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index b32c3dc90..175862d5d 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -662,15 +662,15 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @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 ifNodeHasAnnounced () { + public function ifNodeIsAnnouncing () { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeHasAnnounced(): state=' . $this->getStateInstance()->getStateName()); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeIsAnnouncing(): state=' . $this->getStateInstance()->getStateName()); // Simply check the state of this node - $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncedState); + $hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncingState); // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeHasAnnounced(): hasAnnounced=' . intval($hasAnnounced)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced)); // Return it return $hasAnnounced; diff --git a/application/hub/main/states/node/class_BaseNodeState.php b/application/hub/main/states/node/class_BaseNodeState.php index 3f3974dd6..90e8fbd3a 100644 --- a/application/hub/main/states/node/class_BaseNodeState.php +++ b/application/hub/main/states/node/class_BaseNodeState.php @@ -55,9 +55,9 @@ class BaseNodeState extends BaseState { * @return void * @throws InvalidStateException If the state is not 'active' and not 'announcing' */ - public function validateNodeStateIsActiveOrAnnounced () { + public function validateNodeStateIsActiveOrAnnouncing () { // Just compare it... - if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeAnnouncedState)) { + if ((!$this instanceof NodeActiveState) && (!$this instanceof NodeAnnouncingState)) { // Throw the exception throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE); } // END - if