This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: gnu.java.net.PlainSocketImpl
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Wed, 29 Oct 2003 12:41:56 +0100
- Subject: FYI: Patch: gnu.java.net.PlainSocketImpl
Hi list,
I commited the attached patch fix the setOption methods. I always wondered
why they throw an exception with the message "Success" when calling for some
options like with setKeepAlive().
Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2302
diff -u -b -B -r1.2302 ChangeLog
--- ChangeLog 27 Oct 2003 11:02:42 -0000 1.2302
+++ ChangeLog 29 Oct 2003 10:16:21 -0000
@@ -1,3 +1,10 @@
+2003-10-29 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/natPlainDatagramSocketImplPosix.cc
+ (setOption): Directly return if no error occured.
+ * gnu/java/net/natPlainSocketImplPosix.cc
+ (setOption): Likewise.
+
2003-10-26 Mark Wielaard <mark@klomp.org>
Reported by Helmer Kraemer <hkraemer@freenet.de>
Index: gnu/java/net/natPlainDatagramSocketImplPosix.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc,v
retrieving revision 1.2
diff -u -b -B -r1.2 natPlainDatagramSocketImplPosix.cc
--- gnu/java/net/natPlainDatagramSocketImplPosix.cc 21 Oct 2003 12:29:43 -0000 1.2
+++ gnu/java/net/natPlainDatagramSocketImplPosix.cc 29 Oct 2003 10:16:21 -0000
@@ -516,12 +516,12 @@
if (::setsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val,
val_len) != 0)
goto error;
- break;
+ return;
case _Jv_SO_OOBINLINE_ :
throw new ::java::net::SocketException (
JvNewStringUTF ("SO_OOBINLINE: not valid for UDP"));
- break;
+ return;
case _Jv_SO_SNDBUF_ :
case _Jv_SO_RCVBUF_ :
@@ -590,12 +590,12 @@
case _Jv_IP_MULTICAST_IF2_ :
throw new ::java::net::SocketException (
JvNewStringUTF ("IP_MULTICAST_IF2: not yet implemented"));
- break;
+ return;
case _Jv_IP_MULTICAST_LOOP_ :
throw new ::java::net::SocketException (
JvNewStringUTF ("IP_MULTICAST_LOOP: not yet implemented"));
- break;
+ return;
case _Jv_IP_TOS_ :
if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val,
Index: gnu/java/net/natPlainSocketImplPosix.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/natPlainSocketImplPosix.cc,v
retrieving revision 1.3
diff -u -b -B -r1.3 natPlainSocketImplPosix.cc
--- gnu/java/net/natPlainSocketImplPosix.cc 21 Oct 2003 12:29:43 -0000 1.3
+++ gnu/java/net/natPlainSocketImplPosix.cc 29 Oct 2003 10:16:22 -0000
@@ -622,18 +622,18 @@
if (::setsockopt (native_fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &val,
val_len) != 0)
goto error;
- break;
+ return;
case _Jv_SO_BROADCAST_ :
throw new ::java::net::SocketException
(JvNewStringUTF ("SO_BROADCAST not valid for TCP"));
- break;
+ return;
case _Jv_SO_OOBINLINE_ :
if (::setsockopt (native_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &val,
val_len) != 0)
goto error;
- break;
+ return;
case _Jv_SO_LINGER_ :
#ifdef SO_LINGER
@@ -676,18 +676,18 @@
case _Jv_IP_MULTICAST_IF2_ :
throw new ::java::net::SocketException (
JvNewStringUTF ("IP_MULTICAST_IF2: not valid for TCP"));
- break;
+ return;
case _Jv_IP_MULTICAST_LOOP_ :
throw new ::java::net::SocketException (
JvNewStringUTF ("IP_MULTICAST_LOOP: not valid for TCP"));
- break;
+ return;
case _Jv_IP_TOS_ :
if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val,
val_len) != 0)
goto error;
- break;
+ return;
case _Jv_SO_REUSEADDR_ :
throw new ::java::net::SocketException (