diff --git a/src/iperf.h b/src/iperf.h index d50b9d0..74e41dc 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -29,7 +29,9 @@ struct iperf_interval_results struct tcp_info tcpInfo; /* getsockopt(TCP_INFO) for Linux and FreeBSD */ int this_retrans; #else - char *tcpInfo; /* just a placeholder */ + /* Just placeholders, never accessed. */ + char *tcpInfo; + int this_retrans; #endif TAILQ_ENTRY(iperf_interval_results) irlistentries; void *custom_data; diff --git a/src/iperf_api.c b/src/iperf_api.c index dca1e05..4ceb1d7 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1273,13 +1273,15 @@ iperf_stats_callback(struct iperf_test * test) temp.interval_duration = timeval_diff(&temp.interval_start_time, &temp.interval_end_time); //temp.interval_duration = timeval_diff(&temp.interval_start_time, &temp.interval_end_time); if (test->protocol->id == Ptcp && has_tcpinfo()) { - irp = TAILQ_LAST(&rp->interval_results, irlisthead); - if (irp == NULL) - prev_total_retransmits = 0; - else - prev_total_retransmits = get_tcpinfo_total_retransmits(irp); save_tcpinfo(sp, &temp); - temp.this_retrans = get_tcpinfo_total_retransmits(&temp) - prev_total_retransmits; + if (has_tcpinfo_retransmits()) { + irp = TAILQ_LAST(&rp->interval_results, irlisthead); + if (irp == NULL) + prev_total_retransmits = 0; + else + prev_total_retransmits = get_tcpinfo_total_retransmits(irp); + temp.this_retrans = get_tcpinfo_total_retransmits(&temp) - prev_total_retransmits; + } } add_to_interval_list(rp, &temp); rp->bytes_sent_this_interval = rp->bytes_received_this_interval = 0;