- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient);
- assert($recipient == NetworkPacke::NETWORK_TARGET_DHT);
- $this->partialStub('Please implement this method. recipient=' . $recipient);
+ assert($recipient == NetworkPackage::NETWORK_TARGET_DHT);
+
+ // Get recipient discovery instance
+ $discoverInstance = ObjectFactory::createObjectByConfiguredName('dht_recipient_discovery_class');
+
+ // "Discover" recipients by given package data
+ $recipients = $discoverInstance->resolveRecipientsByPackageData($packageData);
+
+ // Now "walk" through all elements and add them to the list
+ foreach ($recipients as $recipient) {
+ // These array elements must exist for this loop:
+ // @TODO Unfinished
+ die(__METHOD__ . ':recipient=' . print_r($recipient, TRUE));
+ assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS]));
+
+ // Put ip and port both together
+ $unl = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS];
+
+ // Add it to the list
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT[' . __METHOD__ . ':' . __LINE__ . ']: Calling listInstance->addEntry(' . $unl . ') ...');
+ $listInstance->addEntry('unl', $unl);
+ } // END - foreach
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT[' . __METHOD__ . ':' . __LINE__ . ']: recipient=' . $recipient . ' - EXIT!');