diff options
author | Olivier Cochard <olivier@FreeBSD.org> | 2020-09-25 16:02:13 +0000 |
---|---|---|
committer | Olivier Cochard <olivier@FreeBSD.org> | 2020-09-25 16:02:13 +0000 |
commit | 0d46edd0bb21e872a2ed42db10b6f1138f64dbe8 (patch) | |
tree | 3c61b20e268d9d39f196dba9af7e06644eaf1e07 /tests | |
parent | 8dc348a47965722ce5302636f1262d8516fba2c3 (diff) | |
download | src-test-0d46edd0bb21e872a2ed42db10b6f1138f64dbe8.tar.gz src-test-0d46edd0bb21e872a2ed42db10b6f1138f64dbe8.zip |
Enable SO_LINGER to the so_reuseport_lb_test regression tests, preventing
many sockets in TIME_WAIT state at the end of the test.
PR: 249885
Reviewed by: markj
Approved by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26549
Notes
Notes:
svn path=/head/; revision=366159
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sys/netinet/so_reuseport_lb_test.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/sys/netinet/so_reuseport_lb_test.c b/tests/sys/netinet/so_reuseport_lb_test.c index f3fc36f8e048f..89014b3597ee0 100644 --- a/tests/sys/netinet/so_reuseport_lb_test.c +++ b/tests/sys/netinet/so_reuseport_lb_test.c @@ -54,6 +54,7 @@ lb_simple_accept_loop(int domain, const struct sockaddr *addr, int sds[], size_t i; int *acceptcnt; int csd, error, excnt, sd; + const struct linger lopt = { 1, 0 }; /* * We expect each listening socket to accept roughly nconns/nsds @@ -73,6 +74,10 @@ lb_simple_accept_loop(int domain, const struct sockaddr *addr, int sds[], ATF_REQUIRE_MSG(error == 0, "connect() failed: %s", strerror(errno)); + error = setsockopt(sd, SOL_SOCKET, SO_LINGER, &lopt, sizeof(lopt)); + ATF_REQUIRE_MSG(error == 0, "Setting linger failed: %s", + strerror(errno)); + /* * Poll the listening sockets. */ |