$message = sprintf('[%s:%d] This node (%s) is not accepting DHT bootstrap requests, but got one from session-id=%s,ip=%s/%s,listen port=%s,status=%s,mode=%s',
$messageArray[0]->__toString(),
$this->getLine(),
- $messageArray[1]->__toString(),
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID],
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP],
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP],
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT],
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS],
- $messageArray[2][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE]
+ $messageArray[0]->getNodeInstance()->__toString(),
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID],
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP],
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP],
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT],
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS],
+ $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE]
);
// Call parent exception constructor
$objectList = $nodeInstance->getListFromAcceptedObjectTypes();
// Add missing (temporary) configuration 'accepted_object_types'
- $this->getConfigInstance()->setConfigEntry('accepted_object_types', implode(BaseHubNode::OBJECT_LIST_SEPARATOR, $objectList));
+ $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS, implode(BaseHubNode::OBJECT_LIST_SEPARATOR, $objectList));
}
/**
*/
protected function removeMessageConfigurationData (array $messageData) {
// Remove temporay configuration
- $this->getConfigInstance()->unsetConfigEntry('accepted_object_types');
+ $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS);
}
}
// Get new instance
$handlerInstance = new NodeMessageDhtBootstrapHandler();
+ // Get node instance
+ $nodeInstance = NodeObjectFactory::createNodeInstance();
+
+ // ... and set it here
+ $handlerInstance->setNodeInstance($nodeInstance);
+
// Return the prepared instance
return $handlerInstance;
}
* @throws DhtBootstrapNotAcceptedException If this node does not accept DHT bootstrap requests
*/
public function handleMessageData (array $messageData, Receivable $packageInstance) {
- // Get node instance
- $nodeInstance = NodeObjectFactory::createNodeInstance();
-
// Is this node accepting DHT bootstrap requests?
- if (!$nodeInstance->isAcceptingDhtBootstrap()) {
+ if (!$this->getNodeInstance()->isAcceptingDhtBootstrap()) {
/*
* This node is not accepting DHT bootstrap requests.
*/
- throw new DhtBootstrapNotAcceptedException(array($this, $nodeInstance, $messageData), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
+ throw new DhtBootstrapNotAcceptedException(array($this, $messageData), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
} // END - if
// Register the DHT bootstrap requesting node with this node
// Debug message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-BOOTSTRAP-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
- // Copy from source to targetKey
+ // Copy from source to target key
$this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));
} // END - foreach
$this->getConfigInstance()->unsetConfigEntry($configKey);
} // END - foreach
- // Remove NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS as well
+ // Remove temporary "special" values as well
$this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
+ $this->getConfigInstance()->unsetConfigEntry('dht_nodes');
}
}