View | Details | Raw Unified | Return to bug 43641
Collapse All | Expand All

(-)apache-tomcat-6.0.14-src.orig/java/org/apache/catalina/tribes/membership/McastServiceImpl.java (-2 / +18 lines)
Lines 22-27 Link Here
22
import java.net.DatagramPacket;
22
import java.net.DatagramPacket;
23
import java.net.InetAddress;
23
import java.net.InetAddress;
24
import java.net.MulticastSocket;
24
import java.net.MulticastSocket;
25
import java.net.BindException;
25
26
26
import org.apache.catalina.tribes.MembershipListener;
27
import org.apache.catalina.tribes.MembershipListener;
27
import java.util.Arrays;
28
import java.util.Arrays;
Lines 162-169 Link Here
162
    }
163
    }
163
    
164
    
164
    protected void setupSocket() throws IOException {
165
    protected void setupSocket() throws IOException {
165
        if (mcastBindAddress != null) socket = new MulticastSocket(new InetSocketAddress(mcastBindAddress, port));
166
        if (mcastBindAddress != null) {
166
        else socket = new MulticastSocket(port);
167
            try {
168
                socket = new MulticastSocket(new InetSocketAddress(address,
169
                                                                   port));
170
            }
171
            catch (BindException e) {
172
                /*
173
                 * On some plattforms (e.g. Linux) it is not possible to bind
174
                 * to the multicast address. In this case only bind to the
175
                 * port.
176
                 */
177
                socket = new MulticastSocket(port);
178
            }
179
        }
180
        else {
181
            socket = new MulticastSocket(port);
182
        }
167
        socket.setLoopbackMode(false); //hint that we don't need loop back messages
183
        socket.setLoopbackMode(false); //hint that we don't need loop back messages
168
        if (mcastBindAddress != null) {
184
        if (mcastBindAddress != null) {
169
			if(log.isInfoEnabled())
185
			if(log.isInfoEnabled())

Return to bug 43641