< prev index next >

src/solaris/native/sun/nio/ch/DatagramChannelImpl.c

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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

@@ -160,11 +160,11 @@
 
     do {
         retry = JNI_FALSE;
         n = recvfrom(fd, buf, len, 0, (struct sockaddr *)&sa, &sa_len);
         if (n < 0) {
-            if (errno == EWOULDBLOCK) {
+            if (errno == EAGAIN || errno == EWOULDBLOCK) {
                 return IOS_UNAVAILABLE;
             }
             if (errno == EINTR) {
                 return IOS_INTERRUPTED;
             }

@@ -237,11 +237,11 @@
       return IOS_THROWN;
     }
 
     n = sendto(fd, buf, len, 0, (struct sockaddr *)&sa, sa_len);
     if (n < 0) {
-        if (errno == EAGAIN) {
+        if (errno == EAGAIN || errno == EWOULDBLOCK) {
             return IOS_UNAVAILABLE;
         }
         if (errno == EINTR) {
             return IOS_INTERRUPTED;
         }
< prev index next >