]> git.mxchange.org Git - hub.git/commitdiff
Allow 'init' state for bootstrap nodes.
authorRoland Haeder <roland@mxchange.org>
Wed, 26 Mar 2014 19:10:17 +0000 (20:10 +0100)
committerRoland Haeder <roland@mxchange.org>
Wed, 26 Mar 2014 19:10:17 +0000 (20:10 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/helper/dht/class_DhtBootstrapHelper.php
application/hub/main/states/dht/class_BaseDhtState.php

index ec5b91eeb102f4b374efd2e7056e7551fe5d5e64..70627b69f244ec669c56c8bf3630362a9b1a6593 100644 (file)
@@ -82,8 +82,11 @@ 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();
+               /*
+                * 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();
index 88c2de0c645ca90128b5fbb1ecd21ac0e8b47fc0..78b10f3cf47b4571918a464ee4b3a0af657c0c08 100644 (file)
@@ -41,9 +41,9 @@ class BaseDhtState extends BaseState {
         * @return      void
         * @throws      InvalidStateException   If the state is not 'virgin'
         */
-       public function validateDhtStateIsVirgin () {
+       public function validateDhtStateIsVirginOrInit () {
                // Just compare it...
-               if (!$this instanceof DhtVirginState) {
+               if ((!$this instanceof DhtVirginState) && (!$this instanceof DhtInitState)) {
                        // Throw the exception
                        throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
                } // END - if