In debug mode, print out SO_SNDBUF when setting up each socket

(regardless of whether this was set explicitly or not).
This commit is contained in:
Bruce A. Mah 2014-03-06 15:11:25 -08:00
parent c9cfca0a93
commit 7af6d5a2f9
No known key found for this signature in database
GPG Key ID: 4984910A8CAAEE8A

View File

@ -184,6 +184,18 @@ iperf_tcp_listen(struct iperf_test *test)
return -1;
}
}
if (test->debug) {
socklen_t optlen = sizeof(opt);
if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(res);
errno = saved_errno;
i_errno = IESETBUF;
return -1;
}
printf("SO_SNDBUF is %u\n", opt);
}
#if defined(linux) && defined(TCP_CONGESTION)
if (test->congestion) {
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
@ -336,6 +348,18 @@ iperf_tcp_connect(struct iperf_test *test)
return -1;
}
}
if (test->debug) {
socklen_t optlen = sizeof(opt);
if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(server_res);
errno = saved_errno;
i_errno = IESETBUF;
return -1;
}
printf("SO_SNDBUF is %u\n", opt);
}
#if defined(linux)
if (test->settings->flowlabel) {
if (server_res->ai_addr->sa_family != AF_INET6) {