< prev index next >

src/java.base/unix/native/libnet/PlainSocketImpl.c

Print this page
rev 50258 : [mq]: 8203369-Check-for-both-EAGAIN-and-EWOULDBLOCK-error-codes

@@ -628,12 +628,12 @@
      * accept connection but ignore ECONNABORTED indicating that
      * connection was eagerly accepted by the OS but was reset
      * before accept() was called.
      *
      * If accept timeout in place and timeout is adjusted with
-     * each ECONNABORTED or EWOULDBLOCK to ensure that semantics
-     * of timeout are preserved.
+     * each ECONNABORTED or EWOULDBLOCK or EAGAIN to ensure that
+     * semantics of timeout are preserved.
      */
     for (;;) {
         int ret;
         jlong currNanoTime;
 

@@ -671,16 +671,16 @@
         if (newfd >= 0) {
             SET_BLOCKING(newfd);
             break;
         }
 
-        /* non (ECONNABORTED or EWOULDBLOCK) error */
-        if (!(errno == ECONNABORTED || errno == EWOULDBLOCK)) {
+        /* non (ECONNABORTED or EWOULDBLOCK or EAGAIN) error */
+        if (!(errno == ECONNABORTED || errno == EWOULDBLOCK || errno == EAGAIN)) {
             break;
         }
 
-        /* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */
+        /* ECONNABORTED or EWOULDBLOCK or EAGAIN error so adjust timeout if there is one. */
         if (nanoTimeout >= NET_NSEC_PER_MSEC) {
             currNanoTime = JVM_NanoTime(env, 0);
             nanoTimeout -= (currNanoTime - prevNanoTime);
             if (nanoTimeout < NET_NSEC_PER_MSEC) {
                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
< prev index next >