]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Added all node types, moved iterator class:
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index c46b4a5c6c522878bd98aba41af029800b947923..0b95a0a357c66c1fe99e4e8fbe1d0d9f2a6572d0 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseHubNode extends BaseHubSystem implements Updateable {
+       /**
+        * Node types
+        */
+       const NODE_TYPE_BOOT    = 'boot';
+       const NODE_TYPE_MASTER  = 'master';
+       const NODE_TYPE_LIST    = 'list';
+       const NODE_TYPE_REGULAR = 'regular';
+
        // Exception constants
        const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00;
 
@@ -263,7 +271,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                                break;
                        } elseif ($ipPortArray[0] == $this->getConfigInstance()->getConfigEntry('node_listen_addr')) {
                                // IP matches listen address. At this point we really don't care
-                               // if we can also listen on that address!
+                               // if we can really listen on that address
                                $isFound = true;
 
                                // Remember the port number
@@ -311,7 +319,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         * @param       $responseInstance       A Responseable class
         * @return      void
         */
-       public function bootstrapAcquireHubId (Requestable $requestInstance, Responseable $responseInstance) {
+       public function bootstrapAcquireNodeId (Requestable $requestInstance, Responseable $responseInstance) {
                // Get a wrapper instance
                $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class');
 
@@ -346,7 +354,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                        // Get a crypto instance
                        $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
 
-                       // Hash and encrypt the string so we become a "node id" aka Hub-Id
+                       // Hash and encrypt the string so we become a node id (also documented as "hub id")
                        $this->setNodeId($cryptoInstance->hashString($cryptoInstance->encryptString($randomString)));
 
                        // Register the node id with our wrapper
@@ -548,7 +556,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         * @param       $responseInstance       A Responseable class
         * @return      void
         */
-       public function activateHub (Requestable $requestInstance, Responseable $responseInstance) {
+       public function activateNode (Requestable $requestInstance, Responseable $responseInstance) {
                // Checks wether a listener is still active and shuts it down if one
                // is still listening.
                if (($this->determineIfListenerIsActive()) && ($this->getIsActive())) {