X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Fhandler%2Fmessage-types%2Frequests%2Fclass_NodeMessageRequestNodeListHandler.php;h=143afbd22945f3d02bd738fb592ebf6c73141f4f;hb=9a1243bea20f7602ef7cdfe912a7db5ee958fba8;hp=4db5c1f5da6d5a1274356768c101573f891c5eb4;hpb=11418f67e82ab51b0623749de5f24d34fbe1cd8a;p=hub.git diff --git a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php index 4db5c1f5d..143afbd22 100644 --- a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -98,13 +98,16 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @return void */ public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + // Add generic first + parent::addArrayToDataSet($dataSetInstance, $messageData); + // Add all ements foreach ($this->messageDataElements as $key) { // Is it there? assert(isset($messageData[$key])); // Add it - $dataSetInstance->addCriteria('node_' . $key, $messageData[$key]); + $dataSetInstance->addCriteria($key, $messageData[$key]); } // END - foreach } @@ -116,16 +119,28 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha */ protected function initMessageConfigurationData (array $messageData) { // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(' REQUEST-HANDLER: messageData=' . print_r($messageData, true)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(' REQUEST-HANDLER[' . __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: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER[' . __LINE__ . ']: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); // Copy from source to targetKey $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); } // END - foreach + + // Query local DHT for nodes except given session id + $nodeList = $this->getDhtInstance()->queryLocalNodeListExceptByMessageData($messageData, $this, XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID, XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES, BaseHubNode::OBJECT_LIST_SEPARATOR); + + // Set it serialized in configuration (temporarily) + $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(serialize($nodeList))); + + // Translate last exception into a status code + $statusCode = $this->getTranslatedStatusFromLastException(); + + // Set it in configuration (temporarily) + $this->getConfigInstance()->setConfigEntry('answer_status', $statusCode); } /** @@ -141,6 +156,10 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha // Now unset this configuration entry (to save some memory again) $this->getConfigInstance()->unsetConfigEntry($configKey); } // END - foreach + + // Remove answer status/node list as well + $this->getConfigInstance()->unsetConfigEntry('answer_status'); + $this->getConfigInstance()->unsetConfigEntry('node_list'); } }