On May 12, 2006, at 2:06 PM, Sven de Marothy wrote:

This adds the 1.5 timeout methods in URLConnection and implements them
for HttUrlConnection (and HttpsUrlConnection).

It also fixes a long-standing bug in the native-target-layer aicas
thingie. SO_TIMEOUT timeout was being used as a socket option, when it's the name of the Java socket option. The POSIX constants are SO_SNDTIMEO
and SO_RCVTIMEO. So timeouts actually work now.
(I could say something nasty here about preprocessor macros.. )


This introduces a warning, and thus doesn't compile with -Werror, and generally doesn't look right (should the operator be `||' and not `|'? Otherwise, you aren't short-circuiting the second call to `setsockopt' if the first fails). Removing the warning just means putting parentheses around the `|' operation.

Index: native/target/generic/target_generic_network.h
===================================================================
RCS file: /sources/classpath/classpath/native/target/generic/ target_generic_network.h,v
retrieving revision 1.21
diff -U3 -r1.21 target_generic_network.h
--- native/target/generic/target_generic_network.h 25 Jan 2006 10:40:13 -0000 1.21 +++ native/target/generic/target_generic_network.h 12 May 2006 20:53:25 -0000
@@ -682,7 +682,8 @@
       \
       __value.tv_sec = flag / 1000; \
       __value.tv_usec = (flag % 1000) * 1000; \
- result=(setsockopt (socketDescriptor,SOL_SOCKET,SO_TIMEOUT,&__value,sizeof(__value)) ==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \ + result = ( setsockopt(socketDescriptor, SOL_SOCKET, SO_SNDTIMEO, &__value, sizeof(__value)) | \ + setsockopt(socketDescriptor, SOL_SOCKET, SO_RCVTIMEO, &__value, sizeof(__value)) == 0) ? TARGET_NATIVE_OK : TARGET_NATIVE_ERROR; \
     } while (0)
#endif

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to