8236925: (dc) Upgrade DatagramChannel socket adaptor to extend MulticastSocket

Reviewed-by: dfuchs
This commit is contained in:
Alan Bateman 2020-01-19 08:02:46 +00:00
parent 6ef474a4f4
commit d4c3278889
7 changed files with 847 additions and 145 deletions

View file

@ -29,6 +29,7 @@ import java.io.IOException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Set;
/**
* The multicast datagram socket class is useful for sending
* and receiving IP multicast packets. A MulticastSocket is
@ -208,6 +209,10 @@ public class MulticastSocket extends DatagramSocket {
public MulticastSocket(SocketAddress bindaddr) throws IOException {
super((SocketAddress) null);
// No further initialization when this is a DatagramChannel socket adaptor
if (this instanceof sun.nio.ch.DatagramSocketAdaptor)
return;
// Enable SO_REUSEADDR before binding
setReuseAddress(true);