]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Refactured sending encoded (raw) data to sockets to a stacker-based approach.
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 1f70cf7419c289eb4a18a8d3e6ce4514c8e2008f..b32c3dc905b5b043415aafbb6f7cc20068acdbbe 100644 (file)
@@ -67,6 +67,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         */
        private $acceptAnnouncements = FALSE;
 
+       /**
+        * Whether this node accepts DHT bootstrap requests (default: FALSE)
+        */
+       private $acceptDhtBootstrap = FALSE;
+
        /**
         * Protected constructor
         *
@@ -474,7 +479,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                $helperInstance->sendPackage($this);
 
                // Change the state, this should be the last line except debug output
-               $this->getStateInstance()->nodeAnnouncedToUpperHubs();
+               $this->getStateInstance()->nodeAnnouncingToUpperHubs();
 
                // Debug output
                self::createDebugInstance(__CLASS__)->debugOutput('HUB-Announcement: FINISHED');
@@ -638,6 +643,19 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                return $acceptAnnouncements;
        }
 
+       /**
+        * Checks whether this node accepts DHT bootstrap requests
+        *
+        * @return      $acceptDhtBootstrap     Whether this node accepts DHT bootstrap requests
+        */
+       public final function isAcceptingDhtBootstrap () {
+               // Check it (this node must be active and not shutdown!)
+               $acceptDhtBootstrap = (($this->acceptDhtBootstrap === TRUE) && ($this->isNodeActive()));
+
+               // Return it
+               return $acceptDhtBootstrap;
+       }
+
        /**
         * Checks whether this node has attempted to announce itself
         *
@@ -688,6 +706,17 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                $this->acceptAnnouncements = $acceptAnnouncements;
        }
 
+       /**
+        * Enables whether this node accepts DHT bootstrap requests
+        *
+        * @param       $acceptDhtBootstrap     Whether this node accepts DHT bootstrap requests (default: TRUE)
+        * @return      void
+        */
+       public final function enableAcceptDhtBootstrap ($acceptDhtBootstrap = TRUE) {
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: Enabling DHT bootstrap requests ...');
+               $this->acceptDhtBootstrap = $acceptDhtBootstrap;
+       }
+
        /**
         * Checks wether this node is accepting node-list requests
         *