]> git.mxchange.org Git - hub.git/commitdiff
Added noisy debug lines + changed asserts to check non-empty IP/port.
authorRoland Haeder <roland@mxchange.org>
Tue, 29 Jul 2014 19:07:43 +0000 (21:07 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 29 Jul 2014 19:07:43 +0000 (21:07 +0200)
Note to self: Rewrite this hard wired stuff into a more flexible code allow
recipients other than IPv4:port.

Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/recipient/dht/class_DhtRecipient.php

index 256fbb9a2cc0dcef52fedefc632ded867c5f7b2b..2432fbab86e58a41df015f755a82df7cddb62147 100644 (file)
@@ -58,8 +58,10 @@ class DhtRecipient extends BaseRecipient implements Recipient {
         * @throws      FrameworkException      Could throw different exceptions depending on implementation
         */
        public function resolveRecipient ($recipient, Listable $listInstance, array $packageData) {
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - CALLED!');
+
                // Make sure the recipient is valid
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient);
                assert($recipient == NetworkPackage::NETWORK_TARGET_DHT);
 
                // Get recipient discovery instance
@@ -71,15 +73,19 @@ class DhtRecipient extends BaseRecipient implements Recipient {
                // Now "walk" through all elements and add them to the list
                foreach ($recipients as $recipient) {
                        // These array elements must exist for this loop:
-                       assert(isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP]));
-                       assert(isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]));
+                       assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP]));
+                       assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]));
 
                        // Put ip and port both together
                        $ipPort = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP] . ':' . $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT];
 
                        // Add it to the list
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT: Calling listInstance->addEntry(' . $ipPort . ') ...');
                        $listInstance->addEntry('ip_port', $ipPort);
                } // END - foreach
+
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - EXIT!');
        }
 }