aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@kitchenlab.org>2018-01-26 11:19:21 -0800
committerGitHub <noreply@github.com>2018-01-26 11:19:21 -0800
commitb481169a5fb298542becd56368679757b10c9c30 (patch)
tree022410b85a63b1af5f121c744c01b85146a0e7d8
parent46cb4b4b904e45c2652006ca339c7cf99c995268 (diff)
downloadiperf3-b481169a5fb298542becd56368679757b10c9c30.tar.gz
Fix large values of -p on FreeBSD by setting a large listen(2) backlog. (#693)
Might be useful for other platforms as well (no effects on Linux because the semantics of listen(2) are subtly different there). Submitted by Matt Macy. Fixes #691.
-rw-r--r--src/net.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net.c b/src/net.c
index 34d7435..f06d4c4 100644
--- a/src/net.c
+++ b/src/net.c
@@ -1,5 +1,5 @@
/*
- * iperf, Copyright (c) 2014, 2015, 2017, The Regents of the University of
+ * iperf, Copyright (c) 2014-2018, The Regents of the University of
* California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved.
@@ -37,6 +37,7 @@
#include <netdb.h>
#include <string.h>
#include <fcntl.h>
+#include <limits.h>
#ifdef HAVE_SENDFILE
#ifdef linux
@@ -256,7 +257,7 @@ netannounce(int domain, int proto, char *local, int port)
freeaddrinfo(res);
if (proto == SOCK_STREAM) {
- if (listen(s, 5) < 0) {
+ if (listen(s, INT_MAX) < 0) {
saved_errno = errno;
close(s);
errno = saved_errno;