]> git.mxchange.org Git - hub.git/commitdiff
Noisy debug line commented out, adding to much 'upper hubs' will result in a warning...
authorRoland Häder <roland@mxchange.org>
Sat, 2 Jun 2012 22:29:08 +0000 (22:29 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 2 Jun 2012 22:29:08 +0000 (22:29 +0000)
application/hub/main/discovery/package/class_PackageRecipientDiscovery.php
application/hub/main/handler/message-types/anouncement/class_NodeMessageAnnouncementHandler.php

index 73a4638677de2d291897a6fe6d2054cfcd803214..bb134eebc729e94785f5aaab72727876605628b8 100644 (file)
@@ -65,6 +65,15 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
                        case NetworkPackage::NETWORK_TARGET_UPPER_HUBS:
                                // Get all bootstrap nodes
                                foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $node) {
+                                       // Is maximum reached?
+                                       if ($this->getListInstance()->count() == $this->getConfigInstance()->getConfigEntry('package_recipient_max_count')) {
+                                               // Debug message
+                                               /* DEBUG: */ $this->debugOutput('DISCOVERY: Going to abort at maximum of ' . $this->getConfigInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!');
+
+                                               // Then stop adding more
+                                               break;
+                                       } // END - if
+
                                        // Debug message
                                        /* DEBUG: */ $this->debugOutput('DISCOVERY: Adding node ' . $node . ' as recipient.');
 
@@ -75,14 +84,17 @@ class PackageRecipientDiscovery extends BaseHubDiscovery implements Discoverable
 
                        // The target 'self' is always the external IP address!
                        case NetworkPackage::NETWORK_TARGET_SELF:
+                               // Determine own port
+                               $port = $this->getConfigInstance()->getConfigEntry('node_' . $this->determineProtocolByPackageData($packageData) . '_listen_port');
+
                                // Determine IP or 'external_ip' if set
                                $ip = HubTools::determineOwnExternalIp();
 
-                               // Get port and add it
-                               $ipPort = $ip . ':' . $this->getConfigInstance()->getConfigEntry('node_' . $this->determineProtocolByPackageData($packageData) . '_listen_port');
-
-                               // Add it to the list
-                               $this->getListInstance()->addEntry('ip_port', $ipPort);
+                               // Is it not empty?
+                               if (!empty($ip)) {
+                                       // Add it to the list
+                                       $this->getListInstance()->addEntry('ip_port', $ip . ':' . $port);
+                               } // END - if
                                break;
 
                        // This may be a direct recipient (node's session id)
index efa2c8b39b75e94f4c422179a8d30b05c91c1342..3a0a302656cbe87e2cf8fe1d38d4d631a8981910 100644 (file)
@@ -134,7 +134,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                // "Walk" throught the translation array
                foreach ($this->messageToConfig as $messageKey => $configKey) {
                        // Debug message
-                       /* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
+                       //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
 
                        // Set the element in configuration
                        $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
@@ -143,7 +143,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                // "Walk" throught the config-copy array
                foreach ($this->configCopy as $targetKey => $sourceKey) {
                        // Debug message
-                       /* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
+                       //* NOISY-DEBUG: */ $this->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
 
                        // Copy from source to targetKey
                        $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));