From eb87de44e2184333ac1b01ba3fd04556ce73a18d Mon Sep 17 00:00:00 2001 From: chegar Date: Fri, 15 Jan 2010 16:31:16 +0000 Subject: [PATCH] 6916922: (sctp) SO_RCVBUF & SO_SNDBUF returns twice the value set Reviewed-by: alanb --- src/solaris/native/sun/nio/ch/SctpNet.c | 4 ++-- test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/solaris/native/sun/nio/ch/SctpNet.c b/src/solaris/native/sun/nio/ch/SctpNet.c index 8a27807c5..f58157f1f 100644 --- a/src/solaris/native/sun/nio/ch/SctpNet.c +++ b/src/solaris/native/sun/nio/ch/SctpNet.c @@ -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; diff --git a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java index d5715b171..f5814a17b 100644 --- a/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java +++ b/test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java @@ -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); -- GitLab