Skip to content

Commit

Permalink
Use a loopback address instead of 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 22, 2020
1 parent 7d60a40 commit 0656e13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

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;
Expand Down Expand Up @@ -362,7 +363,7 @@ public boolean maybeStaleAddress(Exception failure) {
}

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();
Expand Down
3 changes: 2 additions & 1 deletion daemon/src/main/java/org/jboss/fuse/mvnd/daemon/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;
Expand Down Expand Up @@ -93,7 +94,7 @@ public Server(String uid) throws IOException {
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()
Expand Down

0 comments on commit 0656e13

Please sign in to comment.