8206301: Improve NIO stability
Reviewed-by: alanb, mschoene, rhalade
This commit is contained in:
parent
f094ffdbae
commit
8f189f6214
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -95,6 +95,10 @@ Java_sun_nio_ch_DatagramDispatcher_readv0(JNIEnv *env, jclass clazz,
|
|||||||
jint fd = fdval(env, fdo);
|
jint fd = fdval(env, fdo);
|
||||||
struct iovec *iovp = (struct iovec *)address;
|
struct iovec *iovp = (struct iovec *)address;
|
||||||
WSABUF *bufs = malloc(len * sizeof(WSABUF));
|
WSABUF *bufs = malloc(len * sizeof(WSABUF));
|
||||||
|
if (bufs == NULL) {
|
||||||
|
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||||
|
return IOS_THROWN;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy iovec into WSABUF */
|
/* copy iovec into WSABUF */
|
||||||
for(i=0; i<len; i++) {
|
for(i=0; i<len; i++) {
|
||||||
@ -182,6 +186,10 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
|
|||||||
jint fd = fdval(env, fdo);
|
jint fd = fdval(env, fdo);
|
||||||
struct iovec *iovp = (struct iovec *)address;
|
struct iovec *iovp = (struct iovec *)address;
|
||||||
WSABUF *bufs = malloc(len * sizeof(WSABUF));
|
WSABUF *bufs = malloc(len * sizeof(WSABUF));
|
||||||
|
if (bufs == NULL) {
|
||||||
|
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||||
|
return IOS_THROWN;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy iovec into WSABUF */
|
/* copy iovec into WSABUF */
|
||||||
for(i=0; i<len; i++) {
|
for(i=0; i<len; i++) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -219,6 +219,10 @@ Java_sun_nio_ch_WindowsSelectorImpl_resetWakeupSocket0(JNIEnv *env, jclass this,
|
|||||||
/* Prepare corresponding buffer if needed, and then read */
|
/* Prepare corresponding buffer if needed, and then read */
|
||||||
if (bytesToRead > WAKEUP_SOCKET_BUF_SIZE) {
|
if (bytesToRead > WAKEUP_SOCKET_BUF_SIZE) {
|
||||||
char* buf = (char*)malloc(bytesToRead);
|
char* buf = (char*)malloc(bytesToRead);
|
||||||
|
if (buf == NULL) {
|
||||||
|
JNU_ThrowOutOfMemoryError(env, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
recv(scinFd, buf, bytesToRead, 0);
|
recv(scinFd, buf, bytesToRead, 0);
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user