fixed minor issue with server stats

This commit is contained in:
Brian Tierney 2009-11-20 22:38:47 +00:00
parent fda84f3feb
commit 6796ba135a

View File

@ -512,6 +512,9 @@ iperf_reporter_callback(struct iperf_test * test)
bytes += sp->result->interval_results->bytes_transferred; /* sum up all streams */
sp = sp->next;
}
if (bytes <=0 ) /* this can happen if timer goes off just when client exits */
return NULL;
/* next build string with sum of all streams */
sp = test->streams; /* reset back to 1st stream */
if (test->num_streams > 1)
@ -559,15 +562,10 @@ iperf_reporter_callback(struct iperf_test * test)
lost_packets += sp->cnt_error;
}
if (test->role == 'c')
if (bytes > 0 )
{
unit_snprintf(ubuf, UNIT_LEN, (double) (sp->result->bytes_sent), 'A');
unit_snprintf(nbuf, UNIT_LEN, (double) (sp->result->bytes_sent / end_time), test->default_settings->unit_format);
} else
{
unit_snprintf(ubuf, UNIT_LEN, (double) (sp->result->bytes_received), 'A');
unit_snprintf(nbuf, UNIT_LEN, (double) (sp->result->bytes_received/ end_time), test->default_settings->unit_format);
}
unit_snprintf(ubuf, UNIT_LEN, (double) (bytes), 'A');
unit_snprintf(nbuf, UNIT_LEN, (double) (bytes / end_time), test->default_settings->unit_format);
if (test->protocol == Ptcp)
{
@ -598,7 +596,7 @@ iperf_reporter_callback(struct iperf_test * test)
if (sp->outoforder_packets > 0)
printf(report_sum_outoforder, start_time, end_time, sp->cnt_error);
}
}
sp = sp->next;
}
} /* while (sp) */