]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
Updated 'core'.
[hub.git] / application / hub / main / handler / message-types / dht / class_NodeMessageDhtBootstrapHandler.php
index 23225957365fea8b157c598f208ec16584b64f47..0bf5c5964af5cad680798d461747586668834ea2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -36,34 +36,31 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
 
                // Init message data array
                $this->messageDataElements = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT,
                );
 
                // Init message-data->configuration translation array
                $this->messageToConfig = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'your_external_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'your_internal_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'your_session_id'
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'your_session_id'
                );
 
                // Init config-copy array
                $this->configCopy = array(
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'external_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'internal_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => 'node_status',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'session_id',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT => 'node_listen_port',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => 'node_status',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'session_id',
                );
 
                // Init array
                $this->searchData = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
                );
        }
 
@@ -76,12 +73,6 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                // Get new instance
                $handlerInstance = new NodeMessageDhtBootstrapHandler();
 
-               // Get node instance
-               $nodeInstance = NodeObjectFactory::createNodeInstance();
-
-               // ... and set it here
-               $handlerInstance->setNodeInstance($nodeInstance);
-
                // Get a DHT instance
                $dhtInstance = DhtObjectFactory::createDhtInstance('node');
 
@@ -102,7 +93,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
         */
        public function handleMessageData (array $messageData, Receivable $packageInstance) {
                // Is this node accepting DHT bootstrap requests?
-               if (!$this->getNodeInstance()->isAcceptingDhtBootstrap()) {
+               if (!NodeObjectFactory::createNodeInstance()->isAcceptingDhtBootstrap()) {
                        /*
                         * This node is not accepting DHT bootstrap requests.
                         */
@@ -183,7 +174,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                assert(count($nodeList) > 0);
 
                // Set it in configuration
-               $this->getConfigInstance()->setConfigEntry('dht_nodes', base64_encode(serialize($nodeList)));
+               $this->getConfigInstance()->setConfigEntry('dht_nodes', base64_encode(json_encode($nodeList)));
        }
 
        /**