]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/nodes/class_BaseHubNode.php
Updated 'core'.
[hub.git] / application / hub / main / nodes / class_BaseHubNode.php
index 2228b3114ae06925ebd20d19a5302e337421ec8e..1dff70eea9b166becf1ecf95f0b33ebb619caec0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -84,6 +84,9 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // Set it here
                $this->setCryptoInstance($cryptoInstance);
 
+               // Set the node instance in registry
+               Registry::getRegistry()->addInstance('node', $this);
+
                // Init state which sets the state to 'init'
                $this->initState();
        }
@@ -95,7 +98,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         */
        private function initState() {
                // Get the state factory and create the initial state.
-               NodeStateFactory::createNodeStateInstanceByName('init', $this);
+               NodeStateFactory::createNodeStateInstanceByName('init');
        }
 
        /**
@@ -238,7 +241,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // Output all lines
                self::createDebugInstance(__CLASS__)->debugOutput(' ');
                self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active');
-               self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2014 Hub Developer Team');
+               self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team');
                self::createDebugInstance(__CLASS__)->debugOutput(' ');
                self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
                self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain');
@@ -311,7 +314,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                // Output message
                self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Created new session-id: ' . $this->getSessionId() . '');
 
-               // Change the state because the node has auired a hub id
+               // Change the state because the node has aquired a session id
                $this->getStateInstance()->nodeGeneratedSessionId();
        }
 
@@ -743,8 +746,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                $unlInstance = $this->determineUniversalNodeLocator();
 
                // Make sure the instance is valid
-               // * DEBUG: */ $this->debugInstance('unlInstance[]=' . gettype($unlInstance));
-               assert($unlInstance instanceof LocateableNode);
+               if (!$unlInstance instanceof LocateableNode) {
+                       // No valid instance, so better debug this
+                       $this->debugBackTrace('unlInstance[' . gettype($unlInstance) . ']=' . $unlInstance);
+               } // END - if
 
                // ... and the array from it
                $unlData = $unlInstance->getUnlData();