From f61e2125825d5e69ddb10d2232af4ca0e94ecf26 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Sun, 8 Jun 2003 09:25:54 +0000 Subject: [PATCH] 2003-06-08 Michael Koch * java/net/DatagramSocket.java (DatagramSocket): No need to set SO_REUSEADDRESS here. This belongs into the Multicast constructors. * java/net/DatagramSocketImpl.java (getOption): Removed. (setOption): Removed. * java/net/MulticastSocket.java (MulticastSocket): Call setReuseAddress (true). * java/net/SocketImpl.java (getOption): Removed. (setOption): Removed. From-SVN: r67617 --- libjava/ChangeLog | 14 +++++++++++ libjava/java/net/DatagramSocket.java | 6 ----- libjava/java/net/DatagramSocketImpl.java | 32 ------------------------ libjava/java/net/MulticastSocket.java | 3 +++ libjava/java/net/SocketImpl.java | 32 ------------------------ 5 files changed, 17 insertions(+), 70 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 0d086a7cb86..815a1706fd1 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,17 @@ +2003-06-08 Michael Koch + + * java/net/DatagramSocket.java + (DatagramSocket): No need to set SO_REUSEADDRESS here. This belongs + into the Multicast constructors. + * java/net/DatagramSocketImpl.java + (getOption): Removed. + (setOption): Removed. + * java/net/MulticastSocket.java + (MulticastSocket): Call setReuseAddress (true). + * java/net/SocketImpl.java + (getOption): Removed. + (setOption): Removed. + 2003-06-07 Jeff Sturm PR libgcj/10886: diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index d300f20df92..e21ea44e1b4 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -174,9 +174,6 @@ public class DatagramSocket } impl.create(); - // For multicasting, set the socket to be reused (Stevens pp. 195-6). - if (this instanceof MulticastSocket) - impl.setOption(SocketOptions.SO_REUSEADDR, new Boolean(true)); impl.bind(port, laddr == null ? InetAddress.ANY_IF : laddr); @@ -293,9 +290,6 @@ public class DatagramSocket */ public int getLocalPort() { - if (!isBound ()) - return -1; - return impl.getLocalPort(); } diff --git a/libjava/java/net/DatagramSocketImpl.java b/libjava/java/net/DatagramSocketImpl.java index d225645a88a..891c8d183b5 100644 --- a/libjava/java/net/DatagramSocketImpl.java +++ b/libjava/java/net/DatagramSocketImpl.java @@ -284,36 +284,4 @@ public abstract class DatagramSocketImpl implements SocketOptions { return localPort; } - - /** - * Sets the specified option on a socket to the passed in object. For - * options that take an integer argument, the passed in object is an - * Integer. For options that are set to on or off, the - * value passed will be a Boolean. The optionId - * parameter is one of the defined constants in the superinterface. - * - * @param optionId The identifier of the option - * @param val The value to set the option to - * - * @exception SocketException If an error occurs - * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug. - */ - public abstract void setOption(int optionId, Object val) - throws SocketException; - - /** - * Returns the current setting of the specified option. The - * Object returned will be an Integer for options - * that have integer values. For options that are set to on or off, a - * Boolean will be returned. The optionId - * is one of the defined constants in the superinterface. - * - * @param optionId The option identifier - * - * @return The current value of the option - * - * @exception SocketException If an error occurs - * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug. - */ - public abstract Object getOption(int option_id) throws SocketException; } diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index a6dca948c8b..1b7b422e071 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -81,6 +81,7 @@ public class MulticastSocket extends DatagramSocket public MulticastSocket() throws IOException { super(0, null); + setReuseAddress (true); } /** @@ -95,6 +96,7 @@ public class MulticastSocket extends DatagramSocket public MulticastSocket(int port) throws IOException { super(port, null); + setReuseAddress (true); } /** @@ -111,6 +113,7 @@ public class MulticastSocket extends DatagramSocket public MulticastSocket(SocketAddress address) throws IOException { super(address); + setReuseAddress (true); } /** diff --git a/libjava/java/net/SocketImpl.java b/libjava/java/net/SocketImpl.java index 12dcb0b9a5c..25ffe91d1d2 100644 --- a/libjava/java/net/SocketImpl.java +++ b/libjava/java/net/SocketImpl.java @@ -276,38 +276,6 @@ public abstract class SocketImpl implements SocketOptions + ",localport=" + localport + "]"; } - /** - * Sets the specified option on a socket to the passed in object. For - * options that take an integer argument, the passed in object is an - * Integer. For options that are set to on or off, the - * value passed will be a Boolean. The option_id - * parameter is one of the defined constants in the superinterface. - * - * @param option_id The identifier of the option - * @param val The value to set the option to - * - * @exception SocketException If an error occurs - * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug. - */ - public abstract void setOption(int option_id, Object val) - throws SocketException; - - /** - * Returns the current setting of the specified option. The - * Object returned will be an Integer for options - * that have integer values. For options that are set to on or off, a - * Boolean will be returned. The option_id - * is one of the defined constants in the superinterface. - * - * @param option_id The option identifier - * - * @return The current value of the option - * - * @exception SocketException If an error occurs - * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug. - */ - public abstract Object getOption(int option_id) throws SocketException; - /** * Shut down the input side of this socket. Subsequent reads will * return end-of-file. -- 2.30.2