X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=application%2Fhub%2Fmain%2Fnodes%2Fclass_BaseHubNode.php;h=8a091325e91c7ab85a4ef569f78462620f3d1279;hb=f8fb89d6b4f9b4bfbd5498f784043542ea23ec88;hp=1ba56ca42e3dacb73d502a9cba8c16ac0de41776;hpb=7ded3baebf9fca0678a306169ebef250614d183e;p=hub.git diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 1ba56ca42..8a091325e 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -55,10 +55,15 @@ class BaseHubNode extends BaseHubSystem implements Updateable { private $hubIsAnnounced = false; /** - * Whether this hub is active + * Whether this hub is active (default: false) */ private $isActive = false; + /** + * Whether this node accepts announcements (default: false) + */ + private $acceptAnnouncements = false; + /** * Protected constructor * @@ -454,7 +459,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { public function activateNode (Requestable $requestInstance, Responseable $responseInstance) { // Checks whether a listener is still active and shuts it down if one // is still listening. - if (($this->determineIfListenerIsActive()) && ($this->getIsActive())) { + if (($this->determineIfListenerIsActive()) && ($this->isNodeActive()())) { // Shutdown them down before they can hurt anything $this->shutdownListenerPool(); } // END - if @@ -584,7 +589,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { * * @return $isActive Whether the hub is active */ - public final function getIsActive () { + public final function isNodeActive() () { return $this->isActive; } @@ -598,6 +603,30 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $this->isActive = (bool) $isActive; } + /** + * Checks whether this node accepts announcements + * + * @return $acceptsAnnouncements Whether this node accepts announcements + */ + public final function isAcceptingAnnouncements () { + // Check it (this node must be active and not shutdown!) + $acceptsAnnouncements = (($this->acceptsAnnouncements === true) && ($this->isNodeActive()()); + + // Return it + return $acceptsAnnouncements; + } + + /** + * Enables whether this node accepts announcements + * + * @param $acceptsAnnouncements Whether this node accepts announcements (default: true) + * @return void + */ + protected final function enableAcceptingAnnouncements ($acceptsAnnouncements = true) { + $this->acceptAnnouncements = $acceptsAnnouncements; + } + + /** * "Getter for address:port combination *