提交 eb87de44 编写于 作者: C chegar

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

Reviewed-by: alanb
上级 d5425d0a
...@@ -484,7 +484,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0 ...@@ -484,7 +484,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
arglen = sizeof(arg); 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", JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"sun_nio_ch_SctpNet.setIntOption0"); "sun_nio_ch_SctpNet.setIntOption0");
} }
...@@ -517,7 +517,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0 ...@@ -517,7 +517,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
arglen = sizeof(result); 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", JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"sun.nio.ch.Net.getIntOption"); "sun.nio.ch.Net.getIntOption");
return -1; return -1;
......
...@@ -104,7 +104,9 @@ public class SocketOptionTests { ...@@ -104,7 +104,9 @@ public class SocketOptionTests {
sc.setOption(SCTP_NODELAY, true); sc.setOption(SCTP_NODELAY, true);
checkOption(sc, SCTP_NODELAY, true); checkOption(sc, SCTP_NODELAY, true);
sc.setOption(SO_SNDBUF, 16*1024); sc.setOption(SO_SNDBUF, 16*1024);
checkOption(sc, SO_SNDBUF, 16*1024);
sc.setOption(SO_RCVBUF, 16*1024); sc.setOption(SO_RCVBUF, 16*1024);
checkOption(sc, SO_RCVBUF, 16*1024);
checkOption(sc, SO_LINGER, -1); /* default should be negative */ checkOption(sc, SO_LINGER, -1); /* default should be negative */
sc.setOption(SO_LINGER, 2000); sc.setOption(SO_LINGER, 2000);
checkOption(sc, SO_LINGER, 2000); checkOption(sc, SO_LINGER, 2000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册