1
1
Don't count data for tests received after the end of a test.
This prevents is from reporting an incorrect number of bytes
received at the end of the test, which doesn't match up with the
sum of the data received during the test intervals.
Log late receives if debugging mode enabled.

Fixes #692.
Этот коммит содержится в:
Bruce A. Mah 2018-02-23 15:36:25 -08:00 коммит произвёл GitHub
родитель 8740c8cf8e
Коммит c0055199b5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 110 добавлений и 89 удалений

Просмотреть файл

@ -63,8 +63,15 @@ iperf_sctp_recv(struct iperf_stream *sp)
if (r < 0) if (r < 0)
return r; return r;
/* Only count bytes received while we're in the correct state. */
if (sp->test->state == TEST_RUNNING) {
sp->result->bytes_received += r; sp->result->bytes_received += r;
sp->result->bytes_received_this_interval += r; sp->result->bytes_received_this_interval += r;
}
else {
if (sp->test->debug)
printf("Late receive, state = %d\n", sp->test->state);
}
return r; return r;
#else #else

Просмотреть файл

@ -60,8 +60,15 @@ iperf_tcp_recv(struct iperf_stream *sp)
if (r < 0) if (r < 0)
return r; return r;
/* Only count bytes received while we're in the correct state. */
if (sp->test->state == TEST_RUNNING) {
sp->result->bytes_received += r; sp->result->bytes_received += r;
sp->result->bytes_received_this_interval += r; sp->result->bytes_received_this_interval += r;
}
else {
if (sp->test->debug)
printf("Late receive, state = %d\n", sp->test->state);
}
return r; return r;
} }

Просмотреть файл

@ -1,5 +1,5 @@
/* /*
* iperf, Copyright (c) 2014, 2016, 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 * California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of * to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved. * Energy). All rights reserved.
@ -78,6 +78,8 @@ iperf_udp_recv(struct iperf_stream *sp)
if (r <= 0) if (r <= 0)
return r; return r;
/* Only count bytes received while we're in the correct state. */
if (sp->test->state == TEST_RUNNING) {
sp->result->bytes_received += r; sp->result->bytes_received += r;
sp->result->bytes_received_this_interval += r; sp->result->bytes_received_this_interval += r;
@ -169,6 +171,11 @@ iperf_udp_recv(struct iperf_stream *sp)
d = -d; d = -d;
sp->prev_transit = transit; sp->prev_transit = transit;
sp->jitter += (d - sp->jitter) / 16.0; sp->jitter += (d - sp->jitter) / 16.0;
}
else {
if (sp->test->debug)
printf("Late receive, state = %d\n", sp->test->state);
}
return r; return r;
} }