]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/resolver/protocol/tcp/class_TcpProtocolResolver.php
A lot changes for refacturing protocol handler
[hub.git] / application / hub / main / resolver / protocol / tcp / class_TcpProtocolResolver.php
index 32f86bad3e4a230cc44a21d604801b0e2fbea414..027f0497ff4708ecf8f7ded5fd501f7f29c8707e 100644 (file)
@@ -92,10 +92,27 @@ class TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
         * @return      $unl            Universal node locator
         */
        public function resolveUniversalNodeLocatorFromConfigKey ($configKey) {
+               // Get address
+               $address = $this->getConfigInstance()->getConfigEntry($configKey . '_address');
+
+               // Is the address empty?
+               if (empty($address)) {
+                       // Okay, then find it
+                       switch ($configKey) {
+                               case 'external': // External IP
+                                       $address = ConsoleTools::determineExternalAddress();
+                                       break;
+
+                               case 'internal': // Internal IP
+                                       $address = ConsoleTools::acquireSelfIPAddress();
+                                       break;
+                       } // END - switch
+               } // END - if
+
                // Put all together
                $unl = sprintf('%s://%s:%s',
                        $this->getProtocolName(),
-                       $this->getConfigInstance()->getConfigEntry($configKey . '_address'),
+                       $address,
                        $this->getConfigInstance()->getConfigEntry('node_listen_port')
                );