Skip to content

Commit

Permalink
Only use the source address to join a multicast group if it was speci…
Browse files Browse the repository at this point in the history
…fied. See netty#216
  • Loading branch information
normanmaurer committed Apr 2, 2012
1 parent 7f84080 commit 221a774
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ public ChannelFuture joinGroup(InetAddress multicastAddress, NetworkInterface ne
}

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) {
if (memberships == null) {
memberships = new HashMap<InetAddress, List<MembershipKey>>();
Expand All @@ -147,7 +153,7 @@ public ChannelFuture joinGroup(InetAddress multicastAddress, NetworkInterface ne
keys = new ArrayList<MembershipKey>();
memberships.put(multicastAddress, keys);
}

System.out.println(key);
keys.add(key);
}
} catch (Throwable e) {
Expand Down

0 comments on commit 221a774

Please sign in to comment.