Signed-off-by: Roland Haeder <roland@mxchange.org>
* @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();
* @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