8185072: network006 times out in many configs in JDK10-hs nightly

Reviewed-by: chegar, rriggs
This commit is contained in:
Vyom Tewari 2017-09-26 20:34:10 +05:30
parent 06e15f6982
commit 99b202b398
2 changed files with 890 additions and 7 deletions

View file

@ -679,14 +679,16 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
}
/* ECONNABORTED or EWOULDBLOCK error so adjust timeout if there is one. */
currNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= (currNanoTime - prevNanoTime);
if (nanoTimeout < NET_NSEC_PER_MSEC) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
"Accept timed out");
return;
if (nanoTimeout >= NET_NSEC_PER_MSEC) {
currNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= (currNanoTime - prevNanoTime);
if (nanoTimeout < NET_NSEC_PER_MSEC) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
"Accept timed out");
return;
}
prevNanoTime = currNanoTime;
}
prevNanoTime = currNanoTime;
}
if (newfd < 0) {