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.');
// 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)