Use a loopback address instead of 0.0.0.0

This commit is contained in:
Guillaume Nodet
2020-10-21 22:50:11 +02:00
parent 7d60a403fd
commit 0656e1337a
2 changed files with 4 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ package org.jboss.fuse.mvnd.client;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.channels.SocketChannel;
@@ -362,7 +363,7 @@ public class DaemonConnector {
}
public DaemonConnection<Message> connect(int port) throws DaemonException.ConnectException {
InetSocketAddress address = new InetSocketAddress(port);
InetSocketAddress address = new InetSocketAddress(InetAddress.getLoopbackAddress(), port);
try {
LOGGER.debug("Trying to connect to address {}.", address);
SocketChannel socketChannel = SocketChannel.open();

View File

@@ -18,6 +18,7 @@ package org.jboss.fuse.mvnd.daemon;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
@@ -93,7 +94,7 @@ public class Server implements AutoCloseable, Runnable {
cli = new DaemonMavenCli();
registry = new DaemonRegistry(layout.registry());
socket = ServerSocketChannel.open().bind(new InetSocketAddress(0));
socket = ServerSocketChannel.open().bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
final int idleTimeout = Environment.DAEMON_IDLE_TIMEOUT
.systemProperty()