Skip to content

Commit

Permalink
Merge pull request #6 from chimp1984/listen-localhost-only
Browse files Browse the repository at this point in the history
Use localhost for notification server
  • Loading branch information
sqrrm authored Sep 1, 2019
2 parents fb933fd + 62a51c4 commit b8be37b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import javax.annotation.Nullable;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketTimeoutException;
Expand Down Expand Up @@ -126,11 +127,11 @@ private void activate() throws NotificationHandlerException {
Thread.currentThread().setName(getUniqueName());
isActive = true;
try {
serverSocket = new ServerSocket(serverPort);
serverSocket = new ServerSocket(serverPort, 5, InetAddress.getLoopbackAddress());
serverSocket.setSoTimeout(IDLE_SOCKET_TIMEOUT);
} catch (IOException e) {
try {
serverSocket = new ServerSocket(0);
serverSocket = new ServerSocket(0, 5, InetAddress.getLoopbackAddress());
serverSocket.setSoTimeout(IDLE_SOCKET_TIMEOUT);
LOG.warn("-- activate(..): failed to create server socket (monitor: '{}', port: "
+ "'{}'), reverting to unused port '{}'", type.name(), serverPort,
Expand Down

0 comments on commit b8be37b

Please sign in to comment.