From: Roland Haeder Date: Tue, 29 Jul 2014 19:07:43 +0000 (+0200) Subject: Added noisy debug lines + changed asserts to check non-empty IP/port. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1403a073763ff0264e00635f30d4be48ebe32f66;p=hub.git Added noisy debug lines + changed asserts to check non-empty IP/port. Note to self: Rewrite this hard wired stuff into a more flexible code allow recipients other than IPv4:port. Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/recipient/dht/class_DhtRecipient.php b/application/hub/main/recipient/dht/class_DhtRecipient.php index 256fbb9a2..2432fbab8 100644 --- a/application/hub/main/recipient/dht/class_DhtRecipient.php +++ b/application/hub/main/recipient/dht/class_DhtRecipient.php @@ -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!'); } }