From 1403a073763ff0264e00635f30d4be48ebe32f66 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 29 Jul 2014 21:07:43 +0200 Subject: [PATCH] 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 --- .../hub/main/recipient/dht/class_DhtRecipient.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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!'); } } -- 2.39.2