]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/helper/dht/class_DhtBootstrapHelper.php
Updated copyright
[hub.git] / application / hub / main / helper / dht / class_DhtBootstrapHelper.php
index bf5b21505ac0810d89160682523c1760804e6b44..1fc25af2178cc2268bf917a1f7b02444c18fe2cc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core 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
  * @todo               Find an interface for hub helper
@@ -60,7 +60,7 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht {
         */
        public function loadDescriptorXml (Distributable $dhtInstance) {
                // Debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __LINE__ . ']: Starting with DHT boostrap ...');
+               self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Starting with DHT boostrap ...');
 
                // Get a XML template instance
                $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('dht_bootstrap_template_class');
@@ -82,8 +82,14 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht {
         * @return      void
         */
        public function sendPackage (Distributable $dhtInstance) {
-               // Sanity check: Is the dht in the approx. state? (virgin)
-               $dhtInstance->getStateInstance()->validateDhtStateIsVirgin();
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!');
+
+               /*
+                * Sanity check: Is the DHT in the approx. state? 'init' for bootstrap
+                * nodes and 'virgin' for all others.
+                */
+               $dhtInstance->getStateInstance()->validateDhtStateIsVirginOrInit();
 
                // Compile the template, this inserts the loaded dht data into the gaps.
                $this->getTemplateInstance()->compileTemplate();
@@ -92,7 +98,11 @@ class DhtBootstrapHelper extends BaseHubSystemHelper implements HelpableDht {
                $packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
 
                // Next, feed the content in. The network package class is a pipe-through class.
-               $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+               //* DEBUG: */ die(__METHOD__ . ':dhtInstance=' . print_r($dhtInstance, TRUE));
+               $packageInstance->enqueueRawDataFromTemplate($this);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
        }
 }