]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Many classes/interfaces added/continued:
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 243cb14f58a2413e8fffb7ecc0c24f3b1b807c5d..f27af3018a6feac0903708cd8be4a509ee6f29f4 100644 (file)
@@ -441,7 +441,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
 
        /**
         * Announces this hub to the upper (bootstrap or list) hubs. After this is
-        * successfully done the given task is unregistered from the handler.
+        * successfully done the given task is unregistered from the handler. This
+        * might look a bit overloaded here but the announcement phase isn't a
+        * simple "Hello there" message, it may later on also contain more
+        * informations like the object list.
         *
         * @param       $taskInstance   The task instance running this announcement
         * @return      void
@@ -456,7 +459,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                } // END - if
 
                // Debug output
-               $this->debugOutput('HUB: Self-announcement: START (taskInstance=' . $taskInstance->__toString(). ')');
+               $this->debugOutput('HUB: Self Announcement: START (taskInstance=' . $taskInstance->__toString(). ')');
 
                // Get a helper instance
                $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_announcement_helper_class', array($this));
@@ -477,7 +480,29 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
                $this->getStateInstance()->nodeAnnouncedToUpperHubs();
 
                // Debug output
-               $this->debugOutput('HUB: Self-announcement: FINISHED');
+               $this->debugOutput('HUB: Self Announcement: FINISHED');
+       }
+
+       /**
+        * Does a self-connect attempt on the public IP address. This should make
+        * it sure, we are reachable from outside world. For this kind of package we
+        * don't need that overload we have in the announcement phase.
+        *
+        * @param       $taskInstance   The task instance running this announcement
+        * @return      void
+        */
+       public function doSelfConnection (Taskable $taskInstance) {
+               // Debug output
+               $this->debugOutput('HUB: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')');
+
+               // Get a helper instance
+               $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_self_connect_helper_class', array($this));
+
+               // And send the package away
+               $helperInstance->doSelfConnect();
+
+               // Debug output
+               $this->debugOutput('HUB: Self Connection: FINISHED');
        }
 
        /**