]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/boot/class_HubBootNode.php
Continued with hub:
[hub.git] / application / hub / main / nodes / boot / class_HubBootNode.php
index 166cdb263330794c0727267831961bdbf4bdd36b..c3d1767ca526a6ae4463682250d604f80137b15a 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A hub-node class for the 'Boot' mode
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
         */
        public function doBootstrapping () {
                // Now check if the IP address matches one of the bootstrap nodes
-               if ($this->ifAddressMatchesBootstrappingNodes($this->getConfigInstance()->detectServerAddress())) {
+               if ($this->ifAddressMatchesBootstrapNodes($this->getConfigInstance()->detectServerAddress())) {
                        // Get our port from configuration
                        $ourPort = $this->getConfigInstance()->getConfigEntry('node_listen_port');
 
@@ -69,12 +69,12 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
                        // Is the port the same?
                        if ($bootPort == $ourPort) {
                                // It is the same!
-                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: IP/port matches bootstrapping node ' . $this->getBootIpPort() . '.');
+                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: IP/port matches bootstrap node ' . $this->getBootIpPort() . '.');
 
                                // Now, does the mode match
                                if ($this->getRequestInstance()->getRequestElement('mode') == self::NODE_TYPE_BOOT) {
                                        // Output debug message
-                                       self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Our node is a valid bootstrapping node.');
+                                       self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Our node is a valid bootstrap node.');
                                } else {
                                        // Output warning
                                        self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: WARNING: Mismatching mode ' . $this->getRequestInstance()->getRequestElement('mode') . '!=' . BaseHubNode::NODE_TYPE_BOOT . ' detected.');
@@ -110,6 +110,20 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
                // @TODO Add some filters here
                $this->partialStub('Add some filters here.');
        }
+
+       /**
+        * Adds extra tasks to the given handler for this node
+        *
+        * @param       $handlerInstance        An instance of a HandleableTask class
+        * @return      void
+        */
+       public function addExtraTasks (HandleableTask $handlerInstance) {
+               // Prepare a task for booting the DHT
+               $taskInstance = ObjectFactory::createObjectByConfiguredName('node_dht_bootstrap_task_class');
+
+               // Register it
+               $handlerInstance->registerTask('dht_bootstrap', $taskInstance);
+       }
 }
 
 // [EOF]