]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Added more UNL (Universal Node Locator) stuff:
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 3e0538d177a37a75bc84ec80c7ad0370238c0d3b..e71a63026f12c43db3fd7cd585e1643f65fe1648 100644 (file)
@@ -39,7 +39,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
        /**
         * Universal node locator of bootstrap node
         */
-       private $bootUniversalNodeLocator = '';
+       private $bootUnlInstance = '';
 
        /**
         * Whether this node is anncounced (keep on FALSE!)
@@ -147,10 +147,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
        /**
         * Getter for boot IP/port combination
         *
-        * @return      $bootUniversalNodeLocator               The IP/port combination of the boot node
+        * @return      $bootUnlInstance                The IP/port combination of the boot node
         */
        protected final function getBootUniversalNodeLocator () {
-               return $this->bootUniversalNodeLocator;
+               return $this->bootUnlInstance;
        }
 
        /**
@@ -164,9 +164,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                $isFound = FALSE;
 
                // Run through all configured IPs
-               foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
-                       // Get back an array from the UNL
-                       $unlArray = HubTools::getArrayFromUniversalNodeLocator($unl);
+               foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlArray) {
                        // @TODO Unfinished
                        die(__METHOD__ . ':' . print_r($unlArray, TRUE));
 
@@ -175,11 +173,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                                // Found it!
                                $isFound = TRUE;
 
-                               // Remember the port number
-                               $this->bootUniversalNodeLocator = $unl;
+                               // Remember the UNL array
+                               $this->bootUnlInstance = $unlArray;
 
                                // Output message
-                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $unl . '.');
+                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $unlArray->__toString() . '.');
 
                                // Stop further searching
                                break;
@@ -191,10 +189,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                                $isFound = TRUE;
 
                                // Remember the port number
-                               $this->bootUniversalNodeLocator = $unl;
+                               $this->bootUnlInstance = $unlArray;
 
                                // Output message
-                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $unl . '.');
+                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $unlArray->__toString() . '.');
 
                                // Stop further searching
                                break;
@@ -686,33 +684,33 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
        }
 
        /**
-        * Determines the Universal Node Locator
+        * Determines an instance of a LocateableNode class
         *
-        * @return      $unl    A an Universal Node Locator for this node
+        * @return      $unlInstance    An instance of a LocateableNode class for this node
         */
        public function determineUniversalNodeLocator () {
                // Determine UNL based on this node:
                // 1) Get discovery class
                $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
 
-               // 1) "Determine it
-               $unl = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
+               // 2) "Determine it
+               $unlInstance = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
 
-               // Return it
-               return $unl;
+               // 3) Return it
+               return $unlInstance;
        }
 
        /**
-        * "Getter" for Universal Node Locator array
+        * "Getter" for an array of an instance of a LocateableNode class
         *
-        * @return      $unlArray       An array of the Universal Node Locator for this node
+        * @return      $unlArray       An array from an instance of a LocateableNode class for this node
         */
        public final function getUniversalNodeLocatorArray () {
-               // Get Universal Node Locator (UNL)
-               $unl = $this->determineUniversalNodeLocator();
+               // Get the Universal Node Locator (UNL) instance
+               $unlInstance = $this->determineUniversalNodeLocator();
 
                // @TODO Unfinished
-               die(__METHOD__ . ':' . print_r($unl, TRUE));
+               die(__METHOD__ . ':unlInstance[' . gettype($unlInstance) . ']=' . print_r($unlInstance, TRUE));
 
                // Return it
                return $unlArray;