From fecb120f9125d3db0df5a754f3d0ba87e94b8e12 Mon Sep 17 00:00:00 2001 From: sethdelliott Date: Wed, 16 Mar 2011 18:17:54 +0000 Subject: [PATCH] Fixed TCP_INFO bug on linux. BSD prints nothing for now... --- src/iperf_api.c | 13 ++++++++----- src/tcp_info.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index ffa71ec..89874e4 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -342,6 +342,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) break; case 'T': #if !defined(linux) && !defined(__FreeBSD__) + // XXX: Should check to make sure UDP mode isn't set! warning("TCP_INFO (-T) is not supported on your current platform"); #else test->tcp_info = 1; @@ -1267,11 +1268,6 @@ iperf_reporter_callback(struct iperf_test * test) printf(" Sent\n"); printf(report_bw_format, sp->socket, start_time, end_time, ubuf, nbuf); - if (test->tcp_info) { -// ip = sp->result->last_interval_results; -// print_tcpinfo(ip); - print_tcpinfo(test); - } } else { printf(report_bw_jitter_loss_format, sp->socket, start_time, @@ -1310,6 +1306,13 @@ iperf_reporter_callback(struct iperf_test * test) lost_packets, total_packets, (double) (100.0 * lost_packets / total_packets)); } } + + if (test->tcp_info) { +// ip = sp->result->last_interval_results; +// print_tcpinfo(ip); + print_tcpinfo(test); + } + if (test->verbose) { printf("Host CPU Utilization: %.1f%%\n", test->cpu_util); printf("Remote CPU Utilization: %.1f%%\n", test->remote_cpu_util); diff --git a/src/tcp_info.c b/src/tcp_info.c index 2f07d9a..13feec7 100644 --- a/src/tcp_info.c +++ b/src/tcp_info.c @@ -67,7 +67,7 @@ print_tcpinfo(struct iperf_test *test) struct iperf_stream *sp; #if defined(linux) SLIST_FOREACH(sp, &test->streams, streams) { - retransmits += sp->result->last_interval_results.tcpInfo.tcpi_retransmits; + retransmits += sp->result->last_interval_results->tcpInfo.tcpi_retransmits; } printf("TCP Info\n"); printf(" Retransmits: %ld\n", retransmits);