-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue from github: 20 #21
Conversation
plib/library/Slave.php
Outdated
|
||
$view = new Zend_View(); | ||
$view->setScriptPath(pm_Context::getPlibDir() . 'views/scripts'); | ||
$slaveConfiguration = $view->partial('index/slave-config.phtml', ['masterIp' => $masterIp, 'secret' => $keySecret]); | ||
$slaveConfiguration = $view->partial('index/slave-config.phtml', ['masterIp' => $masterIp, 'masterPublicIp' => $masterPublicIp, 'secret' => $keySecret]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
masterIp is unused now, isn't it?
plib/library/IpAddress.php
Outdated
self::$_publicIpAddresses = []; | ||
|
||
$request = "<ip><get/></ip>"; | ||
$response = pm_ApiRpc::getService('1.6.5.0')->call($request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets avoid copy-paste of api calls. we could have only one static array [ $private => $public ] addresses
Could you also reword the commit to be more informative |
xgin, I updated fix. Please review. |
plib/library/IpAddress.php
Outdated
public static function getDefault() | ||
{ | ||
return reset(self::getAvailable()); | ||
return self::$_defaultIpAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to warmup cache with self::getAvailable().
And we have to return default IP even if nothing was marked as default in API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!self::$_defaultIpAddress) {
$ipAddresses = array_keys(self::getAvailable());
}
return self::$_defaultIpAddress ?: reset($ipAddresses);
plib/library/IpAddress.php
Outdated
self::getAvailable(); | ||
} | ||
|
||
return self::$_ipAddresses[$ipAddress]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify: return self::getAvailable()[$ipAddress]
(the method getAvailable is already responsible for the cache)
Thank you for advice, I applied your recommendations. |
Well done! Let's request for QA assistance & publication. |
Fix for issue #20. This patch set local IP-address for -b (bind) parameter and the extension can work behind the NAT (as an example inside Cloud Environments)