/**
* A NodeMessageRequestNodeList handler
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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.ship-simu.org
+ * @link http://www.shipsimu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
public function handleMessageData (array $messageData, Receivable $packageInstance) {
// Get node instance
- $nodeInstance = Registry::getRegistry()->getInstance('node');
+ $nodeInstance = NodeObjectFactory::createNodeInstance();
// Is this node accepting announcements?
if (!$nodeInstance->isAcceptingNodeListRequests()) {
*/
protected function initMessageConfigurationData (array $messageData) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: messageData=' . print_r($messageData, true));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: messageData=' . print_r($messageData, TRUE));
// "Walk" throught the config-copy array
foreach ($this->configCopy as $targetKey => $sourceKey) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
// Copy from source to targetKey
$this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));
} // END - foreach
- // Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: Got a node list of ' . count($nodeList) . ' entry/-ies back.');
-
// Query local DHT for nodes except given session id
$nodeList = $this->getDhtInstance()->queryLocalNodeListExceptByMessageData(
$messageData,
BaseHubNode::OBJECT_LIST_SEPARATOR
);
+ // Debug message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __METHOD__ . ':' . __LINE__ . ']: Got a node list of ' . count($nodeList) . ' entry/-ies back.');
+
// Set it serialized in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(serialize($nodeList)));
+ $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList)));
// Translate last exception into a status code
$statusCode = $this->getTranslatedStatusFromLastException();
// Set it in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry('answer_status', $statusCode);
+ $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
}
/**
} // END - foreach
// Remove answer status/node list as well
- $this->getConfigInstance()->unsetConfigEntry('answer_status');
+ $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
$this->getConfigInstance()->unsetConfigEntry('node_list');
}
}