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)
Этот коммит содержится в:
родитель
7da3d76096
Коммит
48e66b9b9a
@ -291,8 +291,8 @@ iperf_strerror(int i_errno)
|
|||||||
perr = 1;
|
perr = 1;
|
||||||
break;
|
break;
|
||||||
case IESETCONGESTION:
|
case IESETCONGESTION:
|
||||||
snprintf(errstr, len, "unable to set TCP_CONGESTION");
|
snprintf(errstr, len, "unable to set TCP_CONGESTION: "
|
||||||
perr = 1;
|
"Supplied congestion control algorithm not supported on this host");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,10 +187,8 @@ iperf_tcp_listen(struct iperf_test *test)
|
|||||||
#if defined(linux)
|
#if defined(linux)
|
||||||
if (test->congestion) {
|
if (test->congestion) {
|
||||||
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
||||||
saved_errno = errno;
|
|
||||||
close(s);
|
close(s);
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
errno = saved_errno;
|
|
||||||
i_errno = IESETCONGESTION;
|
i_errno = IESETCONGESTION;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -378,10 +376,8 @@ iperf_tcp_connect(struct iperf_test *test)
|
|||||||
#if defined(linux)
|
#if defined(linux)
|
||||||
if (test->congestion) {
|
if (test->congestion) {
|
||||||
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
if (setsockopt(s, IPPROTO_TCP, TCP_CONGESTION, test->congestion, strlen(test->congestion)) < 0) {
|
||||||
saved_errno = errno;
|
|
||||||
close(s);
|
close(s);
|
||||||
freeaddrinfo(server_res);
|
freeaddrinfo(server_res);
|
||||||
errno = saved_errno;
|
|
||||||
i_errno = IESETCONGESTION;
|
i_errno = IESETCONGESTION;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user