From: Roland Häder Date: Thu, 17 May 2012 19:16:44 +0000 (+0000) Subject: Added basicly finished (except TODO) handling of self-connect messages X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=749195f6c44c8e8171f714432b541ae51e812731;p=hub.git Added basicly finished (except TODO) handling of self-connect messages --- diff --git a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index 9fdb29c3d..3b4c13892 100644 --- a/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/main/handler/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -62,7 +62,21 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * @return void */ public function handleMessageData (array $messageData, Receivable $packageInstance) { - die(__METHOD__ . ':messageData=' . print_r($messageData, true)); + // Are node id and session id the same? + if (($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_NODE_ID] == $this->getNodeId()) && ($messageData[XmlSelfConnectTemplateEngine::SELF_CONNECT_DATA_SESSION_ID] == $this->getSessionId())) { + // Both are equal + $this->debugOutput('SELF-CONNECT: Have connected to myself, node and session id are equal!'); + + // Get node instance ... + $nodeInstance = Registry::getRegistry()->getInstance('node'); + + // ... and change state + $nodeInstance->getStateInstance()->nodeHasSelfConnected(); + } else { + // Something really horrible happened + // @TODO Throw an exception here instead of dying + $this->debugInstance(__METHOD__ . ':IDs mismatch! messageData=' . print_r($messageData, true)); + } } /**