< prev index next >

src/solaris/native/java/net/PlainSocketImpl.c

Print this page
rev 13048 : 8203369: Check for both EAGAIN and EWOULDBLOCK error codes
Reviewed-by: alanb

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -691,12 +691,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;
 
         /* first usage pick up current time */

@@ -736,16 +736,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 (timeout) {
             jlong currTime = JVM_CurrentTimeMillis(env, 0);
             timeout -= (currTime - prevTime);
 
             if (timeout <= 0) {
< prev index next >