]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/discovery/package/class_PackageRecipientDiscovery.php
Added missing XML, config entries for DHT bootstrap
[hub.git] / application / hub / main / discovery / package / class_PackageRecipientDiscovery.php
index f862936b69b52518664e7286d4d3c2f6b244a4c6..6bd982d83f09c8bb33a4930b8974dc469c2a6eb4 100644 (file)
@@ -57,12 +57,12 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
         *
         * @param       $packageData    Raw package data array
         * @return      void
+        * @todo        Find a better way than this switch/case/default thing
         */
        public function discoverRecipients (array $packageData) {
                // We do some rudimentary checks but this might be a bit ugly
                switch ($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]) {
-                       // All upper hubs, these are currently the bootstrap nodes and later on prepended list-nodes
-                       case NetworkPackage::NETWORK_TARGET_UPPER_NODES:
+                       case NetworkPackage::NETWORK_TARGET_UPPER_NODES: // All upper hubs, these are currently the bootstrap nodes and later on prepended list-nodes
                                // Get all bootstrap nodes
                                foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $ipPort) {
                                        // Is maximum reached?
@@ -82,8 +82,7 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
                                } // END - foreach
                                break;
 
-                       // The target 'self' is always the external IP address!
-                       case NetworkPackage::NETWORK_TARGET_SELF:
+                       case NetworkPackage::NETWORK_TARGET_SELF: // The target 'self' is always the external IP address!
                                // Determine own port
                                $port = $this->getConfigInstance()->getConfigEntry('node_listen_port');
 
@@ -97,8 +96,11 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
                                } // END - if
                                break;
 
-                       // This may be a direct recipient (node's session id)
-                       default:
+                       case NetworkPackage::NETWORK_TARGET_DHT: // The target 'dht' is a list from local DHT query
+                               $this->partialStub('DHT recipient unimplemented: packageData=' . print_r($packageData, true));
+                               break;
+
+                       default: // This may be a direct recipient (node's session id)
                                /*
                                 * Try to solve it, if an exception comes back, it is not a
                                 * session-id, nor IP:port and not a hostname:port combination.