src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
changeset 50275 69204b98dc3d
parent 47216 71c04702a3d5
child 59329 289000934908
equal deleted inserted replaced
50274:33a890c972c3 50275:69204b98dc3d
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   140 
   140 
   141     do {
   141     do {
   142         retry = JNI_FALSE;
   142         retry = JNI_FALSE;
   143         n = recvfrom(fd, buf, len, 0, &sa.sa, &sa_len);
   143         n = recvfrom(fd, buf, len, 0, &sa.sa, &sa_len);
   144         if (n < 0) {
   144         if (n < 0) {
   145             if (errno == EWOULDBLOCK) {
   145             if (errno == EAGAIN || errno == EWOULDBLOCK) {
   146                 return IOS_UNAVAILABLE;
   146                 return IOS_UNAVAILABLE;
   147             }
   147             }
   148             if (errno == EINTR) {
   148             if (errno == EINTR) {
   149                 return IOS_INTERRUPTED;
   149                 return IOS_INTERRUPTED;
   150             }
   150             }
   215       return IOS_THROWN;
   215       return IOS_THROWN;
   216     }
   216     }
   217 
   217 
   218     n = sendto(fd, buf, len, 0, &sa.sa, sa_len);
   218     n = sendto(fd, buf, len, 0, &sa.sa, sa_len);
   219     if (n < 0) {
   219     if (n < 0) {
   220         if (errno == EAGAIN) {
   220         if (errno == EAGAIN || errno == EWOULDBLOCK) {
   221             return IOS_UNAVAILABLE;
   221             return IOS_UNAVAILABLE;
   222         }
   222         }
   223         if (errno == EINTR) {
   223         if (errno == EINTR) {
   224             return IOS_INTERRUPTED;
   224             return IOS_INTERRUPTED;
   225         }
   225         }