6916922: (sctp) SO_RCVBUF & SO_SNDBUF returns twice the value set

Reviewed-by: alanb
This commit is contained in:
Chris Hegarty 2010-01-15 16:31:16 +00:00
parent 152798a7ef
commit c5c869ce94
2 changed files with 4 additions and 2 deletions

View File

@ -484,7 +484,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
arglen = sizeof(arg);
}
if (setsockopt(fd, klevel, kopt, parg, arglen) < 0) {
if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) {
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"sun_nio_ch_SctpNet.setIntOption0");
}
@ -517,7 +517,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
arglen = sizeof(result);
}
if (getsockopt(fd, klevel, kopt, arg, &arglen) < 0) {
if (NET_GetSockOpt(fd, klevel, kopt, arg, &arglen) < 0) {
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"sun.nio.ch.Net.getIntOption");
return -1;

View File

@ -104,7 +104,9 @@ public class SocketOptionTests {
sc.setOption(SCTP_NODELAY, true);
checkOption(sc, SCTP_NODELAY, true);
sc.setOption(SO_SNDBUF, 16*1024);
checkOption(sc, SO_SNDBUF, 16*1024);
sc.setOption(SO_RCVBUF, 16*1024);
checkOption(sc, SO_RCVBUF, 16*1024);
checkOption(sc, SO_LINGER, -1); /* default should be negative */
sc.setOption(SO_LINGER, 2000);
checkOption(sc, SO_LINGER, 2000);