diff options
author | Andreas Schneider <asn@samba.org> | 2015-10-08 11:02:10 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2015-10-14 10:27:54 +0200 |
commit | 84a4e23728a558984f449610b9e84933acfb0515 (patch) | |
tree | 31c9afa66f8424c6d3aae8d33f344f143a503c56 /tests/test_echo_tcp_socket_options.c | |
parent | 96dbeb75f78665cf81a4ef8e3842e819043f8d51 (diff) | |
download | socket_wrapper-84a4e23728a558984f449610b9e84933acfb0515.tar.gz socket_wrapper-84a4e23728a558984f449610b9e84933acfb0515.tar.xz socket_wrapper-84a4e23728a558984f449610b9e84933acfb0515.zip |
tests: Add test for TCP_NODELAY setsockopt()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'tests/test_echo_tcp_socket_options.c')
-rw-r--r-- | tests/test_echo_tcp_socket_options.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_echo_tcp_socket_options.c b/tests/test_echo_tcp_socket_options.c index 9be2bf0..dfa46fe 100644 --- a/tests/test_echo_tcp_socket_options.c +++ b/tests/test_echo_tcp_socket_options.c @@ -325,6 +325,17 @@ static void test_sockopt_tcp(void **state) assert_return_code(rc, errno); assert_int_equal(opt, 0); + opt = 1; /* Turn on TCP_NODELAY */ + optlen = sizeof(int); + rc = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, optlen); + assert_return_code(rc, errno); + + opt = -1; + optlen = sizeof(int); + rc = getsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen); + assert_return_code(rc, errno); + assert_int_equal(opt, 1); + close(s); } |