This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.net
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Sun, 8 Jun 2003 11:29:02 +0200
- Subject: FYI: Patch: java.net
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to trunk to remove the miranda methods
in SocketImpl and DatagramSocketImpl and to fix MulticastSocket. I
dont see a reason why we should have a special case DatagramSocket
for MulticastSocket objects when we can do it in MulticastSocket
directly easily (as JDK docs propose it).
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+4wHeWSOgCCdjSDsRAnNmAKCI474Qxfpgfy2sQ4xjbb0SNEI/cACdGa6n
ecakqHHTadbaF1MQqpBKJSM=
=jsLz
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1924
diff -u -b -B -r1.1924 ChangeLog
--- ChangeLog 7 Jun 2003 14:30:30 -0000 1.1924
+++ ChangeLog 8 Jun 2003 09:22:10 -0000
@@ -1,3 +1,17 @@
+2003-06-08 Michael Koch <konqueror@gmx.de>
+
+ * 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 Michael Koch <konqueror@gmx.de>
* include/posix.h
Index: java/net/DatagramSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/DatagramSocket.java,v
retrieving revision 1.24
diff -u -b -B -r1.24 DatagramSocket.java
--- java/net/DatagramSocket.java 25 May 2003 11:40:19 -0000 1.24
+++ java/net/DatagramSocket.java 8 Jun 2003 09:22:11 -0000
@@ -174,9 +174,6 @@
}
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 int getLocalPort()
{
- if (!isBound ())
- return -1;
-
return impl.getLocalPort();
}
Index: java/net/DatagramSocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/DatagramSocketImpl.java,v
retrieving revision 1.13
diff -u -b -B -r1.13 DatagramSocketImpl.java
--- java/net/DatagramSocketImpl.java 25 May 2003 11:40:19 -0000 1.13
+++ java/net/DatagramSocketImpl.java 8 Jun 2003 09:22:11 -0000
@@ -284,36 +284,4 @@
{
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
- * <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>optionId</code>
- * 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
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>optionId</code>
- * 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;
}
Index: java/net/MulticastSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/MulticastSocket.java,v
retrieving revision 1.20
diff -u -b -B -r1.20 MulticastSocket.java
--- java/net/MulticastSocket.java 10 Mar 2003 14:48:09 -0000 1.20
+++ java/net/MulticastSocket.java 8 Jun 2003 09:22:11 -0000
@@ -81,6 +81,7 @@
public MulticastSocket() throws IOException
{
super(0, null);
+ setReuseAddress (true);
}
/**
@@ -95,6 +96,7 @@
public MulticastSocket(int port) throws IOException
{
super(port, null);
+ setReuseAddress (true);
}
/**
@@ -111,6 +113,7 @@
public MulticastSocket(SocketAddress address) throws IOException
{
super(address);
+ setReuseAddress (true);
}
/**
Index: java/net/SocketImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/SocketImpl.java,v
retrieving revision 1.13
diff -u -b -B -r1.13 SocketImpl.java
--- java/net/SocketImpl.java 13 Feb 2003 07:33:40 -0000 1.13
+++ java/net/SocketImpl.java 8 Jun 2003 09:22:11 -0000
@@ -277,38 +277,6 @@
}
/**
- * 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
- * <code>Integer</code>. For options that are set to on or off, the
- * value passed will be a <code>Boolean</code>. The <code>option_id</code>
- * 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
- * <code>Object</code> returned will be an <code>Integer</code> for options
- * that have integer values. For options that are set to on or off, a
- * <code>Boolean</code> will be returned. The <code>option_id</code>
- * 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.
*