]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/boot/class_HubBootNode.php
Bootstrap code for boot-node moved to its class
[hub.git] / application / hub / main / nodes / boot / class_HubBootNode.php
index b5bd0606902e4dc931c69841af651a9c284a7e7a..0be26c3d3693ec5c82a760b6dd2453b99ed45909 100644 (file)
@@ -55,12 +55,35 @@ class HubBootNode extends BaseHubNode implements NodeHelper {
         * should communicate with the bootstrap-nodes at this point.
         *
         * @return      void
-        * @todo        Implement this method
+        * @todo        add some more special bootstrap things for this boot node
         */
        public function doBootstrapping () {
                // Call generic (parent) bootstrapping method
                parent::doGenericBootstrapping();
-               $this->partialStub("Please implement this method.");
+
+               // Now check if the IP address matches one of the bootstrap nodes
+               if ($this->ifAddressMatchesBootstrappingNodes($_SERVER['REMOTE_ADDR'])) {
+                       // Get our port
+                       $ourPort = $this->getConfigInstance()->readConfig('node_listen_port');
+
+                       // Is the port the same?
+                       if (substr($this->bootIpPort, -strlen($ourPort), strlen($ourPort)) == $ourPort) {
+                               // It is the same!
+                               $this->getDebugInstance()->output(__FUNCTION__.'['.__LINE__.']: IP/port matches bootstrapping node ' . $this->bootIpPort . '.');
+
+                               // Now, does the mode match (should be 'boot'!)
+                               if ($this->getRequestInstance()->getRequestElement('mode') == 'boot') {
+                                       // Output debug message
+                                       $this->getDebugInstance()->output(__FUNCTION__.'['.__LINE__.']: Our node is a valid bootstrapping node.');
+                               } else {
+                                       // Output warning
+                                       $this->getDebugInstance()->output(__FUNCTION__.'['.__LINE__.']: WARNING! Mismatching mode ' . $this->getRequestInstance()->getRequestElement('mode') . '!=boot detected.');
+                               }
+                       } // END - if
+               } // END - if
+
+               // This might not be all...
+               $this->partialStub("Please implement more bootsrapping steps.");
        }
 }