Change the meaning of the combination of -n and -P flags.

Previously, if you used -n to specify a test sending a specified number
of bytes and -P to send multiple streams in parallel, iperf3 would send
that many bytes on each stream.  With this change it just sends the
specified total number of bytes regardless of how many streams are used.
This commit is contained in:
Jef Poskanzer 2013-02-18 07:19:59 -08:00
parent 96609aecad
commit fbaa2467a6
3 changed files with 16 additions and 23 deletions

View File

@ -592,18 +592,6 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
return 0;
}
int
all_data_sent(struct iperf_test *test)
{
if (test->settings->bytes > 0) {
if (test->bytes_sent >= (test->num_streams * test->settings->bytes)) {
return 1;
}
}
return 0;
}
int
iperf_send(struct iperf_test *test, fd_set *write_setP)
{

View File

@ -162,7 +162,6 @@ void sig_handler(int);
void usage();
void usage_long();
void warning(char *);
int all_data_sent(struct iperf_test *);
int iperf_exchange_results(struct iperf_test *);
int iperf_init_test(struct iperf_test *);
int iperf_parse_arguments(struct iperf_test *, int, char **);

View File

@ -230,16 +230,22 @@ iperf_run_client(struct iperf_test * test)
(void) gettimeofday(&now, NULL);
tmr_run(&now);
/* Send TEST_END if all data has been sent or timer expired */
if (all_data_sent(test) || test->done) {
cpu_util(&test->cpu_util);
test->stats_callback(test);
test->state = TEST_END;
if (Nwrite(test->ctrl_sck, &test->state, sizeof(char), Ptcp) < 0) {
i_errno = IESENDMESSAGE;
return -1;
}
}
/* Is the test done yet? */
if (test->settings->bytes == 0) {
if (!test->done)
continue; /* not done */
} else {
if (test->bytes_sent < test->settings->bytes)
continue; /* not done */
}
/* Yes, done! Send TEST_END. */
cpu_util(&test->cpu_util);
test->stats_callback(test);
test->state = TEST_END;
if (Nwrite(test->ctrl_sck, &test->state, sizeof(char), Ptcp) < 0) {
i_errno = IESENDMESSAGE;
return -1;
}
}
}
}