classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: [Jamvm-general] Problem with sockets on JamVM version 1.3.3 an


From: Mark Wielaard
Subject: Re: [Fwd: [Jamvm-general] Problem with sockets on JamVM version 1.3.3 and Classpath 0.18]
Date: Tue, 20 Sep 2005 14:15:33 +0200

Hi,

On Sun, 2005-09-18 at 23:04 +0200, Mark Wielaard wrote:
> Could you retry with that patch applied? And report the error message given?
> And could you send a self contained example, the snippet of code wasn't
> runnable on its own. Or, if winstone is free software a quick start with
> steps to repeat to get the same error.

Martin sent me a out of the box setup and with my previous patch that
gave:

[Winstone 2005/09/20 13:53:49] - HTTP Listener started: port=8080
[Winstone 2005/09/20 13:53:49] - Winstone Server v0.7-cvs running:
controlPort=disabled
[Winstone 2005/09/20 13:53:54] - Error during HTTP listener init or
shutdown
java.io.IOException: Resource temporarily unavailable
   at gnu.java.net.PlainSocketImpl.accept (Native Method)
   at java.net.ServerSocket.implAccept (ServerSocket.java:370)
   at java.net.ServerSocket.accept (ServerSocket.java:325)
   at winstone.HttpListener.run (HttpListener.java:135)
   at java.lang.Thread.run (Thread.java:674)

Note that the exception occurs exactly 5 seconds after the Listener is
started and the winstone code we find:

    protected static int LISTENER_TIMEOUT = 5000; // every 5s reset the
                                                    // listener socket
    [...]
                ss.setSoTimeout(LISTENER_TIMEOUT);

And indeed, we only handle timeouts for normal socket receives, not for
server socket accepts. This patch fixes it:

2005-09-20  Mark Wielaard  <address@hidden>

       * native/jni/java-net/javanet.c (_javanet_accept): Throw
       SocketTimeoutException on EAGAIN timeout.

With this winstone starts up and produces html for me.

Committed,

Mark
Index: native/jni/java-net/javanet.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.c,v
retrieving revision 1.24
diff -u -r1.24 javanet.c
--- native/jni/java-net/javanet.c       19 Sep 2005 10:37:57 -0000      1.24
+++ native/jni/java-net/javanet.c       20 Sep 2005 12:13:04 -0000
@@ -856,8 +856,12 @@
          && (TARGET_NATIVE_LAST_ERROR ()
              != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
        {
-         JCL_ThrowException (env, IO_EXCEPTION,
-                             TARGET_NATIVE_LAST_ERROR_STRING ());
+         if (TARGET_NATIVE_LAST_ERROR () == EAGAIN)
+           JCL_ThrowException (env, "java/net/SocketTimeoutException",
+                               "Timeout");
+         else
+           JCL_ThrowException (env, IO_EXCEPTION,
+                               TARGET_NATIVE_LAST_ERROR_STRING ());
          return;
        }
     }

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]