Only use the source address to join a multicast group if it was specified. See #216
This commit is contained in:
parent
7f8408065b
commit
221a77409a
@ -136,7 +136,13 @@ public final class NioDatagramChannel extends AbstractNioChannel implements io.n
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MembershipKey key = getJdkChannel().getChannel().join(multicastAddress, networkInterface);
|
MembershipKey key;
|
||||||
|
if (source == null) {
|
||||||
|
key = getJdkChannel().getChannel().join(multicastAddress, networkInterface);
|
||||||
|
} else {
|
||||||
|
key = getJdkChannel().getChannel().join(multicastAddress, networkInterface, source);
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (memberships == null) {
|
if (memberships == null) {
|
||||||
memberships = new HashMap<InetAddress, List<MembershipKey>>();
|
memberships = new HashMap<InetAddress, List<MembershipKey>>();
|
||||||
@ -147,7 +153,7 @@ public final class NioDatagramChannel extends AbstractNioChannel implements io.n
|
|||||||
keys = new ArrayList<MembershipKey>();
|
keys = new ArrayList<MembershipKey>();
|
||||||
memberships.put(multicastAddress, keys);
|
memberships.put(multicastAddress, keys);
|
||||||
}
|
}
|
||||||
|
System.out.println(key);
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user