|
@@ -135,6 +135,7 @@ public class Client implements AutoCloseable {
|
|
|
private final int connectionTimeout;
|
|
|
|
|
|
private final boolean fallbackAllowed;
|
|
|
+ private final boolean bindToWildCardAddress;
|
|
|
private final byte[] clientId;
|
|
|
private final int maxAsyncCalls;
|
|
|
private final AtomicInteger asyncCallCounter = new AtomicInteger(0);
|
|
@@ -674,10 +675,10 @@ public class Client implements AutoCloseable {
|
|
|
InetAddress localAddr = NetUtils.getLocalInetAddress(host);
|
|
|
if (localAddr != null) {
|
|
|
this.socket.setReuseAddress(true);
|
|
|
- if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Binding " + principal + " to " + localAddr);
|
|
|
- }
|
|
|
- bindAddr = new InetSocketAddress(localAddr, 0);
|
|
|
+ localAddr = NetUtils.bindToLocalAddress(localAddr,
|
|
|
+ bindToWildCardAddress);
|
|
|
+ LOG.debug("Binding {} to {}", principal, localAddr);
|
|
|
+ this.socket.bind(new InetSocketAddress(localAddr, 0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1277,6 +1278,13 @@ public class Client implements AutoCloseable {
|
|
|
CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT);
|
|
|
this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY,
|
|
|
CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT);
|
|
|
+ this.bindToWildCardAddress = conf
|
|
|
+ .getBoolean(CommonConfigurationKeys.IPC_CLIENT_BIND_WILDCARD_ADDR_KEY,
|
|
|
+ CommonConfigurationKeys.IPC_CLIENT_BIND_WILDCARD_ADDR_DEFAULT);
|
|
|
+ LOG.debug("{} set to true. Will bind client sockets to wildcard "
|
|
|
+ + "address.",
|
|
|
+ CommonConfigurationKeys.IPC_CLIENT_BIND_WILDCARD_ADDR_KEY);
|
|
|
+
|
|
|
this.clientId = ClientId.getClientId();
|
|
|
this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance();
|
|
|
this.maxAsyncCalls = conf.getInt(
|