disabled timer for -n option

This commit is contained in:
kaustubhprabhu 2009-07-28 20:21:30 +00:00
parent 5212846ff4
commit c5038eea0a
2 changed files with 11 additions and 3 deletions

View File

@ -63,7 +63,6 @@ int all_data_sent(struct iperf_test *test)
if(total_bytes >= (test->num_streams * test->default_settings->bytes))
{
return 1;
}
else
@ -724,6 +723,7 @@ void iperf_defaults(struct iperf_test *testp)
testp->default_settings->rate = RATE;
testp->default_settings->state = TEST_START;
testp->default_settings->mss = 0;
testp->default_settings->bytes = 0;
for(i=0; i<37; i++)
testp->default_settings->cookie[i] = '\0';
@ -1535,7 +1535,11 @@ void iperf_run_client(struct iperf_test *test)
}
}
timer = new_timer(test->duration, 0);
// if -n specified, set zero timer
if(test->default_settings->bytes == 0)
timer = new_timer(test->duration, 0);
else
timer = new_timer(0,0);
if(test->stats_interval != 0)
stats_interval = new_timer(test->stats_interval, 0);

View File

@ -31,6 +31,10 @@ timeval_diff(struct timeval *tv0, struct timeval *tv1)
int
timer_expired(struct timer *tp)
{
// for timer with zero time
if (tp->end.tv_sec == tp->begin.tv_sec && tp->end.tv_usec == tp->begin.tv_usec)
return 0;
struct timeval now;
int64_t end = 0, current= 0, diff= 0;
if(gettimeofday(&now, NULL) < 0) {