// And ask it for the session id
$recipient = $wrapperInstance->resolveIpPortBySessionId($sessionId);
+ // Is the recipient invalid?
+ if ($recipient == 'invalid:invalid') {
+ // Get the instance, this might throw a NPE
+ $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+ // Is the session id the same?
+ if ($nodeInstance->getSessionId() == $sessionId) {
+ // Then get the ip:port from it, assume TCP by default
+ $recipient = self::determineOwnExternalIp() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_tcp_listen_port');
+ } // END - if
+ } // END - if
+
// Return result
return $recipient;
}
// Return it
return $recipient;
}
+
+ /**
+ * Determine IP or 'external_ip' if set
+ *
+ * @return $ip The determined external ip of this node
+ */
+ public static function determineOwnExternalIp () {
+ // Is the external_ip config entry set?
+ if (FrameworkConfiguration::getInstance()->getConfigEntry('external_ip') != '') {
+ // Use it as external ip
+ $ip = FrameworkConfiguration::getInstance()->getConfigEntry('external_ip');
+ } else {
+ // Determine own external ip by connecting to my (coder) server at 188.138.90.169
+ $ip = ConsoleTools::determineExternalIp();
+ }
+
+ // Return it
+ return $ip;
+ }
}
// [EOF]