jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
changeset 44916 54d70322b32c
parent 43100 a7e3457672c7
child 44921 0672237e13c0
equal deleted inserted replaced
44915:18cd524cf7dc 44916:54d70322b32c
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2017, 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
   483     if (IS_NULL(addressObj)) {
   483     if (IS_NULL(addressObj)) {
   484         JNU_ThrowNullPointerException(env, "Null address in peek()");
   484         JNU_ThrowNullPointerException(env, "Null address in peek()");
   485         return -1;
   485         return -1;
   486     }
   486     }
   487     if (timeout) {
   487     if (timeout) {
   488         int ret = NET_Timeout(fd, timeout);
   488         int ret = NET_Timeout(env, fd, timeout, JVM_NanoTime(env, 0));
   489         if (ret == 0) {
   489         if (ret == 0) {
   490             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   490             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   491                             "Peek timed out");
   491                             "Peek timed out");
   492             return ret;
   492             return ret;
   493         } else if (ret == -1) {
   493         } else if (ret == -1) {
   574         return -1;
   574         return -1;
   575     }
   575     }
   576     packetBufferOffset = (*env)->GetIntField(env, packet, dp_offsetID);
   576     packetBufferOffset = (*env)->GetIntField(env, packet, dp_offsetID);
   577     packetBufferLen = (*env)->GetIntField(env, packet, dp_bufLengthID);
   577     packetBufferLen = (*env)->GetIntField(env, packet, dp_bufLengthID);
   578     if (timeout) {
   578     if (timeout) {
   579         int ret = NET_Timeout(fd, timeout);
   579         int ret = NET_Timeout(env, fd, timeout, JVM_NanoTime(env, 0));
   580         if (ret == 0) {
   580         if (ret == 0) {
   581             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   581             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   582                             "Receive timed out");
   582                             "Receive timed out");
   583             return -1;
   583             return -1;
   584         } else if (ret == -1) {
   584         } else if (ret == -1) {
   787 
   787 
   788     do {
   788     do {
   789         retry = JNI_FALSE;
   789         retry = JNI_FALSE;
   790 
   790 
   791         if (timeout) {
   791         if (timeout) {
   792             int ret = NET_Timeout(fd, timeout);
   792             int ret = NET_Timeout(env, fd, timeout, JVM_NanoTime(env, 0));
   793             if (ret <= 0) {
   793             if (ret <= 0) {
   794                 if (ret == 0) {
   794                 if (ret == 0) {
   795                     JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   795                     JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
   796                                     "Receive timed out");
   796                                     "Receive timed out");
   797                 } else if (ret == -1) {
   797                 } else if (ret == -1) {