src/java.base/unix/native/libnet/PlainSocketImpl.c
changeset 50275 69204b98dc3d
parent 49431 5812849b5027
child 53422 6f02e036630e
equal deleted inserted replaced
50274:33a890c972c3 50275:69204b98dc3d
   628      * accept connection but ignore ECONNABORTED indicating that
   628      * accept connection but ignore ECONNABORTED indicating that
   629      * connection was eagerly accepted by the OS but was reset
   629      * connection was eagerly accepted by the OS but was reset
   630      * before accept() was called.
   630      * before accept() was called.
   631      *
   631      *
   632      * If accept timeout in place and timeout is adjusted with
   632      * If accept timeout in place and timeout is adjusted with
   633      * each ECONNABORTED or EWOULDBLOCK to ensure that semantics
   633      * each ECONNABORTED or EWOULDBLOCK or EAGAIN to ensure that
   634      * of timeout are preserved.
   634      * semantics of timeout are preserved.
   635      */
   635      */
   636     for (;;) {
   636     for (;;) {
   637         int ret;
   637         int ret;
   638         jlong currNanoTime;
   638         jlong currNanoTime;
   639 
   639 
   671         if (newfd >= 0) {
   671         if (newfd >= 0) {
   672             SET_BLOCKING(newfd);
   672             SET_BLOCKING(newfd);
   673             break;
   673             break;
   674         }
   674         }
   675 
   675 
   676         /* non (ECONNABORTED or EWOULDBLOCK) error */
   676         /* non (ECONNABORTED or EWOULDBLOCK or EAGAIN) error */
   677         if (!(errno == ECONNABORTED || errno == EWOULDBLOCK)) {
   677         if (!(errno == ECONNABORTED || errno == EWOULDBLOCK || errno == EAGAIN)) {
   678             break;
   678             break;
   679         }
   679         }
   680 
   680 
   681         /* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */
   681         /* ECONNABORTED or EWOULDBLOCK or EAGAIN error so adjust timeout if there is one. */
   682         if (nanoTimeout >= NET_NSEC_PER_MSEC) {
   682         if (nanoTimeout >= NET_NSEC_PER_MSEC) {
   683             currNanoTime = JVM_NanoTime(env, 0);
   683             currNanoTime = JVM_NanoTime(env, 0);
   684             nanoTimeout -= (currNanoTime - prevNanoTime);
   684             nanoTimeout -= (currNanoTime - prevNanoTime);
   685             if (nanoTimeout < NET_NSEC_PER_MSEC) {
   685             if (nanoTimeout < NET_NSEC_PER_MSEC) {
   686                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   686                 JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",