From bca7c39f82084a93e3dc7087dfd49f9ff7320e12 Mon Sep 17 00:00:00 2001 From: cliffclick Date: Thu, 21 Aug 2014 12:10:02 -0700 Subject: [PATCH] setReuseAddress=true on API port ...windows issues be damned... this is for linux-in-production --- src/main/java/water/H2O.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/water/H2O.java b/src/main/java/water/H2O.java index 3caecdf35b..b8b1b6bbc4 100644 --- a/src/main/java/water/H2O.java +++ b/src/main/java/water/H2O.java @@ -1060,13 +1060,10 @@ static void initializeNetworkSockets( ) { // If the user specified the -ip flag, honor it for the Web UI interface bind. // Otherwise bind to all interfaces. - if (OPT_ARGS.ip != null) { - int defaultBacklog = -1; - _apiSocket = new ServerSocket(API_PORT, defaultBacklog, SELF_ADDRESS); - } - else { - _apiSocket = new ServerSocket(API_PORT); - } + _apiSocket = OPT_ARGS.ip == null + ? new ServerSocket(API_PORT) + : new ServerSocket(API_PORT, -1/*defaultBacklog*/, SELF_ADDRESS); + _apiSocket.setReuseAddress(true); _udpSocket = DatagramChannel.open(); _udpSocket.socket().setReuseAddress(true);