rever back all interfaces binding in multicast

This commit is contained in:
kimchy 2010-05-27 13:12:33 +03:00
parent d7984e9962
commit 71ece4e31c
1 changed files with 14 additions and 12 deletions

View File

@ -34,11 +34,13 @@ import org.elasticsearch.util.TimeValue;
import org.elasticsearch.util.component.AbstractLifecycleComponent; import org.elasticsearch.util.component.AbstractLifecycleComponent;
import org.elasticsearch.util.io.stream.*; import org.elasticsearch.util.io.stream.*;
import org.elasticsearch.util.network.NetworkService; import org.elasticsearch.util.network.NetworkService;
import org.elasticsearch.util.network.NetworkUtils;
import org.elasticsearch.util.settings.Settings; import org.elasticsearch.util.settings.Settings;
import java.io.IOException; import java.io.IOException;
import java.net.*; import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketTimeoutException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
@ -135,16 +137,16 @@ public class MulticastZenPing extends AbstractLifecycleComponent<ZenPing> implem
try { try {
MulticastSocket multicastSocket; MulticastSocket multicastSocket;
if (NetworkUtils.canBindToMcastAddress()) { // if (NetworkUtils.canBindToMcastAddress()) {
try { // try {
multicastSocket = new MulticastSocket(new InetSocketAddress(group, port)); // multicastSocket = new MulticastSocket(new InetSocketAddress(group, port));
} catch (Exception e) { // } catch (Exception e) {
logger.debug("Failed to create multicast socket by binding to group address, binding to port", e); // logger.debug("Failed to create multicast socket by binding to group address, binding to port", e);
multicastSocket = new MulticastSocket(port); // multicastSocket = new MulticastSocket(port);
} // }
} else { // } else {
multicastSocket = new MulticastSocket(port); multicastSocket = new MulticastSocket(port);
} // }
multicastSocket.setTimeToLive(ttl); multicastSocket.setTimeToLive(ttl);