< prev index next >

src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2017, 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

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

@@ -215,11 +215,11 @@
       return IOS_THROWN;
     }
 
     n = sendto(fd, buf, len, 0, &sa.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 >