Improve error message for TCP congestion algorithm setting failure.

Also remove a couple of places where we were saving and restoring errno
where we didn't need to.

Submitted by:	Susant Sahani <ssahani@redhat.com>
Issue:		121 (TCP congestion control algorithm support for client)
This commit is contained in:
Bruce A. Mah 2014-01-02 13:49:56 -08:00
parent 7da3d76096
commit 48e66b9b9a
2 changed files with 2 additions and 6 deletions

View File

@ -291,8 +291,8 @@ iperf_strerror(int i_errno)
perr = 1;
break;
case IESETCONGESTION:
snprintf(errstr, len, "unable to set TCP_CONGESTION");
perr = 1;
snprintf(errstr, len, "unable to set TCP_CONGESTION: "
"Supplied congestion control algorithm not supported on this host");
break;
}

View File

@ -187,10 +187,8 @@ iperf_tcp_listen(struct iperf_test *test)
#if defined(linux)
if (test->congestion) {
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(res);
errno = saved_errno;
i_errno = IESETCONGESTION;
return -1;
}
@ -378,10 +376,8 @@ iperf_tcp_connect(struct iperf_test *test)
#if defined(linux)
if (test->congestion) {
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
saved_errno = errno;
close(s);
freeaddrinfo(server_res);
errno = saved_errno;
i_errno = IESETCONGESTION;
return -1;
}