mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
iperf: bump to version 2.1.8 (#7239)
This commit is contained in:
@@ -7,11 +7,13 @@ COPYRIGHT="1999-2007 Board of Trustees of University of Illinois"
|
||||
LICENSE="UIUC"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://downloads.sourceforge.net/iperf2/iperf-${portVersion}.tar.gz"
|
||||
CHECKSUM_SHA256="062b392e87b8e227aca74fef0a99b04fe0382d4518957041b508a56885b4d4f9"
|
||||
CHECKSUM_SHA256="8e2cf2fbc9d0d4d1cf9d109b1e328459f9622993dc9a4c5a7dc8a2088fb7beaf"
|
||||
SOURCE_DIR="iperf-$portVersion"
|
||||
|
||||
if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
|
||||
PATCHES="iperf-$portVersion.gcc2.patchset"
|
||||
PATCHES="
|
||||
iperf-$portVersion.gcc2.patchset
|
||||
"
|
||||
fi
|
||||
|
||||
ARCHITECTURES="all"
|
||||
@@ -1,28 +1,50 @@
|
||||
From c7e369241391c97532aba898a64757b15afe2649 Mon Sep 17 00:00:00 2001
|
||||
From 01213ca45ed5baa50174b57a0f820d758268a9c3 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Tue, 2 Oct 2018 16:31:18 +0200
|
||||
Subject: gcc2 patch
|
||||
|
||||
|
||||
diff --git a/src/ReportOutputs.c b/src/ReportOutputs.c
|
||||
index b69636c..e6342fd 100644
|
||||
index 6d124de..fde6f64 100644
|
||||
--- a/src/ReportOutputs.c
|
||||
+++ b/src/ReportOutputs.c
|
||||
@@ -228,9 +228,11 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
|
||||
@@ -252,9 +252,11 @@ void tcp_output_read_enhanced (struct TransferInfo *stats) {
|
||||
fflush(stdout);
|
||||
}
|
||||
void tcp_output_read_enhanced_triptime (struct TransferInfo *stats) {
|
||||
void tcp_output_read_triptime (struct TransferInfo *stats) {
|
||||
+ double meantransit;
|
||||
+ double lambda;
|
||||
HEADING_PRINT_COND(report_bw_read_enhanced_netpwr);
|
||||
- double meantransit = (stats->transit.cntTransit > 0) ? (stats->transit.sumTransit / stats->transit.cntTransit) : 0;
|
||||
- double meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
|
||||
- double lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
|
||||
+ meantransit = (stats->transit.cntTransit > 0) ? (stats->transit.sumTransit / stats->transit.cntTransit) : 0;
|
||||
+ meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
|
||||
+ lambda = (stats->IPGsum > 0.0) ? ((double)stats->cntBytes / stats->IPGsum) : 0.0;
|
||||
set_llawbuf(lambda, meantransit, stats);
|
||||
set_llawbuf(lambda, meantransit);
|
||||
_print_stats_common(stats);
|
||||
if (stats->cntBytes) {
|
||||
@@ -931,13 +933,14 @@ static void format_ips_ports_string (struct TransferInfo *stats) {
|
||||
@@ -308,8 +310,9 @@ void tcp_output_read_triptime (struct TransferInfo *stats) {
|
||||
fflush(stdout);
|
||||
}
|
||||
void tcp_output_read_enhanced_isoch (struct TransferInfo *stats) {
|
||||
+ double meantransit;
|
||||
HEADING_PRINT_COND(report_bw_isoch_enhanced_netpwr);
|
||||
- double meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
|
||||
+ meantransit = (stats->transit.current.cnt > 0) ? (stats->transit.current.sum / stats->transit.current.cnt) : 0;
|
||||
_print_stats_common(stats);
|
||||
if (stats->cntBytes) {
|
||||
set_netpowerbuf(meantransit, stats);
|
||||
@@ -432,9 +435,9 @@ void tcp_output_write (struct TransferInfo *stats) {
|
||||
}
|
||||
|
||||
void tcp_output_write_bb (struct TransferInfo *stats) {
|
||||
+ char rps_string[40];
|
||||
HEADING_PRINT_COND(report_client_bb_bw);
|
||||
_print_stats_common(stats);
|
||||
- char rps_string[40];
|
||||
if (stats->final) {
|
||||
double rps = ((stats->fBBrunning > 0) && (stats->bbrtt.total.cnt > 0)) ? ((double) stats->bbrtt.total.cnt / stats->fBBrunning) : 0;
|
||||
if (rps < 10)
|
||||
@@ -1151,13 +1154,14 @@ static void format_ips_ports_string (struct TransferInfo *stats) {
|
||||
}
|
||||
|
||||
void udp_output_basic_csv (struct TransferInfo *stats) {
|
||||
@@ -38,7 +60,7 @@ index b69636c..e6342fd 100644
|
||||
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
|
||||
printf(reportCSV_bw_jitter_loss_format,
|
||||
__timestring,
|
||||
@@ -953,13 +956,14 @@ void udp_output_basic_csv (struct TransferInfo *stats) {
|
||||
@@ -1173,13 +1177,14 @@ void udp_output_basic_csv (struct TransferInfo *stats) {
|
||||
(100.0 * stats->cntError) / stats->cntDatagrams, stats->cntOutofOrder );
|
||||
}
|
||||
void tcp_output_basic_csv (struct TransferInfo *stats) {
|
||||
@@ -54,67 +76,78 @@ index b69636c..e6342fd 100644
|
||||
(((double)stats->cntBytes * 8.0) / (stats->ts.iEnd - stats->ts.iStart)) : 0);
|
||||
printf(reportCSV_bw_format,
|
||||
__timestring,
|
||||
@@ -1179,12 +1183,13 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
// copy the inet_ntop into temp buffers, to avoid overwriting
|
||||
char local_addr[REPORT_ADDRLEN];
|
||||
char remote_addr[REPORT_ADDRLEN];
|
||||
+ char *b;
|
||||
struct sockaddr *local = ((struct sockaddr*)&report->common->local);
|
||||
struct sockaddr *peer = ((struct sockaddr*)&report->common->peer);
|
||||
outbuffer[0]='\0';
|
||||
outbufferext[0]='\0';
|
||||
outbufferext2[0]='\0';
|
||||
- char *b = &outbuffer[0];
|
||||
+ b = &outbuffer[0];
|
||||
if (!isUDP(report->common) && (report->common->socket > 0) && (isPrintMSS(report->common) || isEnhanced(report->common))) {
|
||||
if (isPrintMSS(report->common) && (report->MSS <= 0)) {
|
||||
printf(report_mss_unsupported, report->MSS);
|
||||
@@ -1258,8 +1263,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
if (!isServerReverse(report->common) && (isEnhanced(report->common) || isConnectOnly(report->common))) {
|
||||
if (report->connect_timestamp.tv_sec > 0) {
|
||||
struct tm ts;
|
||||
- ts = *localtime(&report->connect_timestamp.tv_sec);
|
||||
char now_timebuf[80];
|
||||
+ ts = *localtime(&report->connect_timestamp.tv_sec);
|
||||
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
|
||||
if (!isUDP(report->common) && (report->common->ThreadMode == kMode_Client)) {
|
||||
snprintf(b, SNBUFFERSIZE-strlen(b), " (ct=%4.2f ms) on %s", report->connecttime, now_timebuf);
|
||||
@@ -1341,6 +1346,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
char start_timebuf[80];
|
||||
struct timeval now;
|
||||
struct timeval start;
|
||||
+ char now_timebuf[80];
|
||||
+ int seconds_from_now;
|
||||
@@ -1441,15 +1446,18 @@ void reporter_connect_printf_tcp_final (struct ConnectionInfo * report) {
|
||||
}
|
||||
|
||||
void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
- assert(report->common);
|
||||
- // copy the inet_ntop into temp buffers, to avoid overwriting
|
||||
char local_addr[REPORT_ADDRLEN];
|
||||
char remote_addr[REPORT_ADDRLEN];
|
||||
- struct sockaddr *local = ((struct sockaddr*)&report->common->local);
|
||||
- struct sockaddr *peer = ((struct sockaddr*)&report->common->peer);
|
||||
+ struct sockaddr *local;
|
||||
+ struct sockaddr *peer;
|
||||
+ char *b;
|
||||
+ assert(report->common);
|
||||
+ // copy the inet_ntop into temp buffers, to avoid overwriting
|
||||
+ local = ((struct sockaddr*)&report->common->local);
|
||||
+ peer = ((struct sockaddr*)&report->common->peer);
|
||||
outbuffer[0]='\0';
|
||||
outbufferext[0]='\0';
|
||||
- char *b = &outbuffer[0];
|
||||
+ b = &outbuffer[0];
|
||||
|
||||
#if HAVE_DECL_TCP_WINDOW_CLAMP
|
||||
if (!isUDP(report->common) && isRxClamp(report->common)) {
|
||||
@@ -1554,8 +1562,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
if (!isServerReverse(report->common) && (isEnhanced(report->common) || isConnectOnly(report->common))) {
|
||||
if (report->connect_timestamp.tv_sec > 0) {
|
||||
struct tm ts;
|
||||
- ts = *localtime(&report->connect_timestamp.tv_sec);
|
||||
char now_timebuf[80];
|
||||
+ ts = *localtime(&report->connect_timestamp.tv_sec);
|
||||
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
|
||||
if (!isUDP(report->common) && (report->common->ThreadMode == kMode_Client) && (report->tcpinitstats.connecttime > 0)) {
|
||||
snprintf(b, SNBUFFERSIZE-strlen(b), " (ct=%4.2f ms) on %s", report->tcpinitstats.connecttime, now_timebuf);
|
||||
@@ -1635,8 +1643,10 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
if (isTxHoldback(report->common) || isTxStartTime(report->common)) {
|
||||
struct tm ts;
|
||||
char start_timebuf[80];
|
||||
+ char now_timebuf[80];
|
||||
struct timeval now;
|
||||
struct timeval start;
|
||||
+ int seconds_from_now;
|
||||
#ifdef HAVE_CLOCK_GETTIME
|
||||
struct timespec t1;
|
||||
clock_gettime(CLOCK_REALTIME, &t1);
|
||||
@@ -1350,10 +1357,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
gettimeofday(&now, NULL);
|
||||
struct timespec t1;
|
||||
clock_gettime(CLOCK_REALTIME, &t1);
|
||||
@@ -1646,10 +1656,8 @@ void reporter_print_connection_report (struct ConnectionInfo *report) {
|
||||
gettimeofday(&now, NULL);
|
||||
#endif
|
||||
ts = *localtime(&now.tv_sec);
|
||||
- char now_timebuf[80];
|
||||
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
|
||||
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
|
||||
- int seconds_from_now;
|
||||
if (isTxHoldback(report->common)) {
|
||||
seconds_from_now = report->txholdbacktime.tv_sec;
|
||||
if (report->txholdbacktime.tv_usec > 0)
|
||||
ts = *localtime(&now.tv_sec);
|
||||
- char now_timebuf[80];
|
||||
strftime(now_timebuf, sizeof(now_timebuf), "%Y-%m-%d %H:%M:%S (%Z)", &ts);
|
||||
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
|
||||
- int seconds_from_now;
|
||||
if (isTxHoldback(report->common)) {
|
||||
seconds_from_now = report->txholdbacktime.tv_sec;
|
||||
if (report->txholdbacktime.tv_usec > 0)
|
||||
diff --git a/src/Reporter.c b/src/Reporter.c
|
||||
index 2ebfa1b..ded0d7b 100644
|
||||
index 7dc05b3..509ef08 100644
|
||||
--- a/src/Reporter.c
|
||||
+++ b/src/Reporter.c
|
||||
@@ -172,8 +172,9 @@ bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet, struc
|
||||
}
|
||||
#else
|
||||
void ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
|
||||
+ struct TransferInfo *stats;
|
||||
@@ -146,9 +146,9 @@ void PostReport (struct ReportHeader *reporthdr) {
|
||||
* Returns true when the tcpinfo was sampled, false ohterwise
|
||||
*/
|
||||
bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
|
||||
+ bool rc = false;
|
||||
assert(data != NULL);
|
||||
- struct TransferInfo *stats = &data->info;
|
||||
+ stats = &data->info;
|
||||
|
||||
- bool rc = false;
|
||||
#ifdef HAVE_THREAD_DEBUG
|
||||
if (packet->packetID < 0) {
|
||||
thread_debug("Reporting last packet for %p qdepth=%d sock=%d", (void *) data, packetring_getcount(data->packetring), data->info.common->socket);
|
||||
@@ -207,15 +208,17 @@ void ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
|
||||
@@ -196,13 +196,15 @@ bool ReportPacket (struct ReporterData* data, struct ReportStruct *packet) {
|
||||
* It also handles the freeing reports and other closing actions
|
||||
*/
|
||||
int EndJob (struct ReportHeader *reporthdr, struct ReportStruct *finalpacket) {
|
||||
@@ -126,16 +159,14 @@ index 2ebfa1b..ded0d7b 100644
|
||||
- struct ReporterData *report = (struct ReporterData *) reporthdr->this_report;
|
||||
- struct ReportStruct packet;
|
||||
+ report = (struct ReporterData *) reporthdr->this_report;
|
||||
#if defined(HAVE_STRUCT_TCP_INFO_TCPI_TOTAL_RETRANS) | defined(HAVE_THREAD_DEBUG)
|
||||
struct TransferInfo *stats = &report->info;
|
||||
#endif
|
||||
|
||||
memset(&packet, 0, sizeof(struct ReportStruct));
|
||||
- int do_close = 1;
|
||||
+ do_close = 1;
|
||||
/*
|
||||
* Using PacketID of -1 ends reporting
|
||||
* It pushes a "special packet" through
|
||||
@@ -488,10 +491,15 @@ void reporter_spawn (struct thread_Settings *thread) {
|
||||
@@ -512,10 +514,15 @@ void reporter_spawn (struct thread_Settings *thread) {
|
||||
|
||||
// The Transfer or Data report is by far the most complicated report
|
||||
int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
@@ -154,7 +185,7 @@ index 2ebfa1b..ded0d7b 100644
|
||||
// The consumption detector applies delay to the reporter
|
||||
// thread when its consumption rate is too low. This allows
|
||||
// the traffic threads to send aggregates vs thrash
|
||||
@@ -506,8 +514,8 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
@@ -530,8 +537,8 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
if (!isSingleUDP(this_ireport->info.common))
|
||||
apply_consumption_detector();
|
||||
// If there are more packets to process then handle them
|
||||
@@ -165,7 +196,7 @@ index 2ebfa1b..ded0d7b 100644
|
||||
while (!advance_jobq && (packet = packetring_dequeue(this_ireport->packetring))) {
|
||||
// Increment the total packet count processed by this thread
|
||||
// this will be used to make decisions on if the reporter
|
||||
@@ -593,8 +601,9 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
@@ -617,8 +624,9 @@ int reporter_process_transfer_report (struct ReporterData *this_ireport) {
|
||||
*
|
||||
*/
|
||||
inline int reporter_process_report (struct ReportHeader *reporthdr) {
|
||||
@@ -176,7 +207,41 @@ index 2ebfa1b..ded0d7b 100644
|
||||
switch (reporthdr->type) {
|
||||
case DATA_REPORT:
|
||||
done = reporter_process_transfer_report((struct ReporterData *)reporthdr->this_report);
|
||||
@@ -996,8 +1005,8 @@ static inline void reporter_set_timestamps_time (struct ReportTimeStamps *times,
|
||||
@@ -695,10 +703,10 @@ static inline void reporter_compute_packet_pps (struct TransferInfo *stats, stru
|
||||
static void reporter_handle_packet_oneway_transit (struct TransferInfo *stats, struct ReportStruct *packet) {
|
||||
// Transit or latency updates done inline below
|
||||
double transit = TimeDifference(packet->packetTime, packet->sentTime);
|
||||
+ double deltaTransit;
|
||||
if (stats->latency_histogram) {
|
||||
histogram_insert(stats->latency_histogram, transit, NULL);
|
||||
}
|
||||
- double deltaTransit;
|
||||
// from RFC 1889, Real Time Protocol (RTP)
|
||||
// J = J + ( | D(i-1,i) | - J ) /
|
||||
// Compute jitter
|
||||
@@ -913,13 +921,17 @@ void reporter_handle_packet_client (struct ReporterData *data, struct ReportStru
|
||||
}
|
||||
|
||||
void reporter_handle_packet_bb_client (struct ReporterData *data, struct ReportStruct *packet) {
|
||||
+ double bbrtt;
|
||||
+ double bbowdto;
|
||||
+ double bbowdfro;
|
||||
+ double asym;
|
||||
if (!packet->emptyreport && (packet->packetLen > 0)) {
|
||||
struct TransferInfo *stats = &data->info;
|
||||
stats->total.Bytes.current += packet->packetLen;
|
||||
- double bbrtt = TimeDifference(packet->packetTime, packet->sentTime);
|
||||
- double bbowdto = TimeDifference(packet->sentTimeRX, packet->sentTime);
|
||||
- double bbowdfro = TimeDifference(packet->packetTime, packet->sentTimeTX);
|
||||
- double asym = bbowdfro - bbowdto;
|
||||
+ bbrtt = TimeDifference(packet->packetTime, packet->sentTime);
|
||||
+ bbowdto = TimeDifference(packet->sentTimeRX, packet->sentTime);
|
||||
+ bbowdfro = TimeDifference(packet->packetTime, packet->sentTimeTX);
|
||||
+ asym = bbowdfro - bbowdto;
|
||||
stats->ts.prevpacketTime = packet->packetTime;
|
||||
#if 0
|
||||
fprintf(stderr, "BB Debug: ctx=%lx.%lx srx=%lx.%lx stx=%lx.%lx crx=%lx.%lx\n", packet->sentTime.tv_sec, packet->sentTime.tv_usec, packet->sentTimeRX.tv_sec, packet->sentTimeRX.tv_usec, packet->sentTimeTX.tv_sec, packet->sentTimeTX.tv_usec, packet->packetTime.tv_sec, packet->pAckettime.tv_usec);
|
||||
@@ -1079,8 +1091,8 @@ static inline void reporter_set_timestamps_time (struct ReportTimeStamps *times,
|
||||
static inline void reporter_transfer_protocol_missed_reports (struct TransferInfo *stats, struct ReportStruct *packet) {
|
||||
while (TimeDifference(packet->packetTime, stats->ts.nextTime) > TimeDouble(stats->ts.intervalTime)) {
|
||||
// printf("**** cmp=%f/%f next %ld.%ld packet %ld.%ld id=%ld\n", TimeDifference(packet->packetTime, stats->ts.nextTime), TimeDouble(stats->ts.intervalTime), stats->ts.nextTime.tv_sec, stats->ts.nextTime.tv_usec, packet->packetTime.tv_sec, packet->packetTime.tv_usec, packet->packetID);
|
||||
@@ -186,7 +251,7 @@ index 2ebfa1b..ded0d7b 100644
|
||||
memset(&emptystats, 0, sizeof(struct TransferInfo));
|
||||
emptystats.ts.iStart = stats->ts.iStart;
|
||||
emptystats.ts.iEnd = stats->ts.iEnd;
|
||||
@@ -1313,11 +1322,11 @@ void reporter_transfer_protocol_client_udp (struct ReporterData *data, int final
|
||||
@@ -1395,11 +1407,11 @@ void reporter_transfer_protocol_client_udp (struct ReporterData *data, int final
|
||||
}
|
||||
|
||||
void reporter_transfer_protocol_server_tcp (struct ReporterData *data, int final) {
|
||||
@@ -199,7 +264,7 @@ index 2ebfa1b..ded0d7b 100644
|
||||
if (stats->framelatency_histogram) {
|
||||
stats->framelatency_histogram->final = 0;
|
||||
}
|
||||
@@ -1587,18 +1596,21 @@ void reporter_transfer_protocol_fullduplex_udp (struct TransferInfo *stats, int
|
||||
@@ -1726,10 +1738,13 @@ void reporter_transfer_protocol_fullduplex_udp (struct TransferInfo *stats, int
|
||||
|
||||
// Conditional print based on time
|
||||
int reporter_condprint_time_interval_report (struct ReporterData *data, struct ReportStruct *packet) {
|
||||
@@ -214,6 +279,7 @@ index 2ebfa1b..ded0d7b 100644
|
||||
// Print a report if packet time exceeds the next report interval time,
|
||||
// Also signal to the caller to move to the next report (or packet ring)
|
||||
// if there was output. This will allow for more precise interval sum accounting.
|
||||
@@ -1737,8 +1752,8 @@ int reporter_condprint_time_interval_report (struct ReporterData *data, struct R
|
||||
if (TimeDifference(stats->ts.nextTime, packet->packetTime) < 0) {
|
||||
assert(data->transfer_protocol_handler!=NULL);
|
||||
advance_jobq = 1;
|
||||
@@ -224,37 +290,11 @@ index 2ebfa1b..ded0d7b 100644
|
||||
stats->ts.packetTime = packet->packetTime;
|
||||
#ifdef DEBUG_PPS
|
||||
printf("*** packetID TRIGGER = %ld pt=%ld.%ld empty=%d nt=%ld.%ld\n",packet->packetID, packet->packetTime.tv_sec, packet->packetTime.tv_usec, packet->emptyreport, stats->ts.nextTime.tv_sec, stats->ts.nextTime.tv_usec);
|
||||
@@ -1669,10 +1681,12 @@ int reporter_condprint_frame_interval_report_server_tcp (struct ReporterData *da
|
||||
}
|
||||
|
||||
int reporter_condprint_burst_interval_report_server_tcp (struct ReporterData *data, struct ReportStruct *packet) {
|
||||
+ struct TransferInfo *stats;
|
||||
+ int advance_jobq;
|
||||
assert(packet->burstsize != 0);
|
||||
- struct TransferInfo *stats = &data->info;
|
||||
+ stats = &data->info;
|
||||
|
||||
- int advance_jobq = 0;
|
||||
+ advance_jobq = 0;
|
||||
// first packet of a burst and not a duplicate
|
||||
if (packet->transit_ready) {
|
||||
stats->tripTime = reporter_handle_packet_oneway_transit(data, packet);
|
||||
diff --git a/src/Reports.c b/src/Reports.c
|
||||
index 695ec9e..954bd4b 100644
|
||||
index 9c44ace..9debdf1 100644
|
||||
--- a/src/Reports.c
|
||||
+++ b/src/Reports.c
|
||||
@@ -81,8 +81,9 @@ static inline int my_str_copy(char **dst, char *src) {
|
||||
// better encpasulate report handling.
|
||||
static void common_copy (struct ReportCommon **common, struct thread_Settings *inSettings) {
|
||||
// Do deep copies from settings
|
||||
+ int bytecnt;
|
||||
*common = (struct ReportCommon *) calloc(1, sizeof(struct ReportCommon));
|
||||
- int bytecnt = 0;
|
||||
+ bytecnt = 0;
|
||||
bytecnt = my_str_copy(&(*common)->Host, inSettings->mHost);
|
||||
bytecnt += my_str_copy(&(*common)->HideHost, inSettings->mHideHost);
|
||||
bytecnt += my_str_copy(&(*common)->Localhost, inSettings->mLocalhost);
|
||||
@@ -188,13 +189,14 @@ static void free_common_copy (struct ReportCommon *common) {
|
||||
@@ -180,13 +180,14 @@ static void free_common_copy (struct ReportCommon *common) {
|
||||
// this will get the next one. Otherwise it will use
|
||||
// the value.
|
||||
void setTransferID (struct thread_Settings *inSettings, int role_reversal) {
|
||||
@@ -270,7 +310,7 @@ index 695ec9e..954bd4b 100644
|
||||
if (role_reversal) {
|
||||
#ifdef HAVE_ROLE_REVERSAL_ID
|
||||
if (isPermitKey(inSettings) && (inSettings->mPermitKey[0] != '\0')) {
|
||||
@@ -338,9 +340,10 @@ struct SumReport* InitSumReport(struct thread_Settings *inSettings, int inID, in
|
||||
@@ -331,9 +332,10 @@ struct SumReport* InitSumReport(struct thread_Settings *inSettings, int inID, in
|
||||
}
|
||||
|
||||
struct ConnectionInfo * InitConnectOnlyReport (struct thread_Settings *thread) {
|
||||
@@ -282,7 +322,7 @@ index 695ec9e..954bd4b 100644
|
||||
if (!creport) {
|
||||
FAIL(1, "Out of Memory!!\n", thread);
|
||||
}
|
||||
@@ -456,6 +459,7 @@ void IncrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
@@ -452,6 +454,7 @@ void IncrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
}
|
||||
|
||||
int DecrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
@@ -290,7 +330,7 @@ index 695ec9e..954bd4b 100644
|
||||
assert(sumreport);
|
||||
// thread_debug("before lock hdr=%p", (void *)sumreport);
|
||||
Mutex_Lock(&sumreport->reference.lock);
|
||||
@@ -463,7 +467,7 @@ int DecrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
@@ -459,7 +462,7 @@ int DecrSumReportRefCounter (struct SumReport *sumreport) {
|
||||
thread_debug("Sum multiheader %p ref=%d->%d", (void *)sumreport, sumreport->reference.count, (sumreport->reference.count - 1));
|
||||
#endif
|
||||
// thread_debug("in lock hdr=%p", (void *)sumreport);
|
||||
@@ -299,7 +339,7 @@ index 695ec9e..954bd4b 100644
|
||||
Mutex_Unlock(&sumreport->reference.lock);
|
||||
// thread_debug("unlock hdr=%p", (void *)sumreport);
|
||||
return refcnt;
|
||||
@@ -479,8 +483,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
@@ -475,8 +478,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
/*
|
||||
* Create the report header and an ireport (if needed)
|
||||
*/
|
||||
@@ -311,7 +351,7 @@ index 695ec9e..954bd4b 100644
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -491,7 +497,7 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
@@ -487,7 +492,7 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
reporthdr->type = DATA_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
|
||||
@@ -320,10 +360,10 @@ index 695ec9e..954bd4b 100644
|
||||
if (inSettings->mSumReport) {
|
||||
IncrSumReportRefCounter(inSettings->mSumReport);
|
||||
ireport->GroupSumReport = inSettings->mSumReport;
|
||||
@@ -679,8 +685,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
@@ -704,8 +709,10 @@ struct ReportHeader* InitIndividualReport (struct thread_Settings *inSettings) {
|
||||
* and to extend.
|
||||
*/
|
||||
struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, double ct) {
|
||||
struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
|
||||
+ struct ReportHeader *reporthdr;
|
||||
+ struct ConnectionInfo * creport;
|
||||
assert(inSettings != NULL);
|
||||
@@ -332,16 +372,16 @@ index 695ec9e..954bd4b 100644
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -691,7 +699,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, d
|
||||
@@ -716,7 +723,7 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
|
||||
reporthdr->type = CONNECTION_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
|
||||
- struct ConnectionInfo * creport = (struct ConnectionInfo *)(reporthdr->this_report);
|
||||
+ creport = (struct ConnectionInfo *)(reporthdr->this_report);
|
||||
common_copy(&creport->common, inSettings);
|
||||
if (!isUDP(inSettings) && (inSettings->mSock > 0) && !isDontRoute(inSettings) && \
|
||||
!(ct <= 0.0 && (inSettings->mThreadMode == kMode_Client))) {
|
||||
@@ -743,8 +751,10 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings, d
|
||||
tcpstats_copy(&creport->tcpinitstats, &inSettings->tcpinitstats);
|
||||
// Fill out known fields for the connection report
|
||||
@@ -762,8 +769,10 @@ struct ReportHeader* InitConnectionReport (struct thread_Settings *inSettings) {
|
||||
* settings being used with Listeners or Clients
|
||||
*/
|
||||
struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
|
||||
@@ -353,7 +393,7 @@ index 695ec9e..954bd4b 100644
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
}
|
||||
@@ -755,7 +765,7 @@ struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
|
||||
@@ -774,7 +783,7 @@ struct ReportHeader *InitSettingsReport (struct thread_Settings *inSettings) {
|
||||
reporthdr->type = SETTINGS_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
|
||||
@@ -362,7 +402,7 @@ index 695ec9e..954bd4b 100644
|
||||
common_copy(&sreport->common, inSettings);
|
||||
sreport->peer = inSettings->peer;
|
||||
sreport->size_peer = inSettings->size_peer;
|
||||
@@ -784,6 +794,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
@@ -810,6 +819,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
/*
|
||||
* Create the report header and an ireport (if needed)
|
||||
*/
|
||||
@@ -372,7 +412,7 @@ index 695ec9e..954bd4b 100644
|
||||
struct ReportHeader *reporthdr = (struct ReportHeader *) calloc(1, sizeof(struct ReportHeader));
|
||||
if (reporthdr == NULL) {
|
||||
FAIL(1, "Out of Memory!!\n", inSettings);
|
||||
@@ -797,9 +810,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
@@ -823,9 +835,9 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
#endif
|
||||
reporthdr->type = SERVER_RELAY_REPORT;
|
||||
reporthdr->ReportMode = inSettings->mReportMode;
|
||||
@@ -384,7 +424,7 @@ index 695ec9e..954bd4b 100644
|
||||
stats->common->transferID = inSettings->mTransferID;
|
||||
|
||||
stats->jitter = ntohl(server->base.jitter1);
|
||||
@@ -813,7 +826,7 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
@@ -839,7 +851,7 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
stats->ts.iStart = 0;
|
||||
stats->ts.iEnd = ntohl(server->base.stop_sec);
|
||||
stats->ts.iEnd += ntohl(server->base.stop_usec) / (double)rMillion;
|
||||
@@ -393,7 +433,7 @@ index 695ec9e..954bd4b 100644
|
||||
if ((flags & HEADER_SEQNO64B)) {
|
||||
stats->cntError = (((intmax_t) ntohl(server->extend2.error_cnt2)) << 32) + \
|
||||
ntohl(server->base.error_cnt);
|
||||
@@ -862,22 +875,29 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
@@ -889,22 +901,29 @@ struct ReportHeader* InitServerRelayUDPReport(struct thread_Settings *inSettings
|
||||
* Sent by server to client
|
||||
* ------------------------------------------------------------------- */
|
||||
void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
|
||||
@@ -407,18 +447,18 @@ index 695ec9e..954bd4b 100644
|
||||
+ int count;
|
||||
assert(stats!= NULL);
|
||||
- int ackpacket_length = (int) (sizeof(struct UDP_datagram) + sizeof(struct server_hdr));
|
||||
- char *ackPacket = (char *) calloc(1, len);
|
||||
- int readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
- char *ackPacket = (char *) calloc(1, readlen);
|
||||
- int success = 0;
|
||||
+ ackpacket_length = (int) (sizeof(struct UDP_datagram) + sizeof(struct server_hdr));
|
||||
+ ackPacket = (char *) calloc(1, len);
|
||||
+ readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
+ ackPacket = (char *) calloc(1, readlen);
|
||||
+ success = 0;
|
||||
assert(ackPacket);
|
||||
- fd_set readSet;
|
||||
- int rc = 1;
|
||||
- struct timeval timeout;
|
||||
- int readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
+ rc = 1;
|
||||
+ readlen = ((ackpacket_length * 2) > len * 2) ? (ackpacket_length * 2) : (len * 2);
|
||||
|
||||
if (ackPacket) {
|
||||
+ int flags;
|
||||
@@ -431,7 +471,7 @@ index 695ec9e..954bd4b 100644
|
||||
if (isEnhanced(stats->common) || isTripTime(stats->common))
|
||||
flags |= SERVER_HEADER_EXTEND;
|
||||
#ifdef HAVE_INT64_T
|
||||
@@ -920,7 +940,7 @@ void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
|
||||
@@ -948,7 +967,7 @@ void write_UDP_AckFIN (struct TransferInfo *stats, int len) {
|
||||
hdr->extend.IPGsum = htonl(1);
|
||||
|
||||
#define TRYCOUNT 10
|
||||
@@ -441,10 +481,10 @@ index 695ec9e..954bd4b 100644
|
||||
// write data
|
||||
#if defined(HAVE_LINUX_FILTER_H) && defined(HAVE_AF_PACKET)
|
||||
diff --git a/src/Server.cpp b/src/Server.cpp
|
||||
index 53f6949..d1606c5 100644
|
||||
index 65e56a0..86e785b 100644
|
||||
--- a/src/Server.cpp
|
||||
+++ b/src/Server.cpp
|
||||
@@ -449,7 +449,7 @@ bool Server::InitTrafficLoop (void) {
|
||||
@@ -603,7 +603,7 @@ bool Server::InitTrafficLoop (void) {
|
||||
ClientReverseFirstRead();
|
||||
}
|
||||
if (isTripTime(mSettings)) {
|
||||
@@ -454,10 +494,10 @@ index 53f6949..d1606c5 100644
|
||||
fprintf(stdout,"WARN: ignore --trip-times because client didn't provide valid start timestamp within %d seconds of now\n", MAXDIFFTIMESTAMPSECS);
|
||||
mSettings->accept_time.tv_sec = now.getSecs();
|
||||
diff --git a/src/histogram.c b/src/histogram.c
|
||||
index 3f45432..bf9b912 100644
|
||||
index 5bb8820..2df448a 100644
|
||||
--- a/src/histogram.c
|
||||
+++ b/src/histogram.c
|
||||
@@ -173,15 +173,16 @@ void histogram_add(struct histogram *to, struct histogram *from) {
|
||||
@@ -175,15 +175,16 @@ void histogram_add(struct histogram *to, struct histogram *from) {
|
||||
}
|
||||
|
||||
void histogram_print(struct histogram *h, double start, double end) {
|
||||
@@ -477,7 +517,7 @@ index 3f45432..bf9b912 100644
|
||||
intervalpopulation = h->populationcnt - h->prev->populationcnt;
|
||||
strcpy(h->outbuf, h->myname);
|
||||
sprintf(h->outbuf, "[%3d] " IPERFTimeFrmt " sec %s%s%s bin(w=%d%s):cnt(%d)=", h->id, start, end, h->myname, (h->final ? "(f)" : ""), "-PDF:",h->binwidth, ((h->units == 1e3) ? "ms" : "us"), intervalpopulation);
|
||||
@@ -192,7 +193,6 @@ void histogram_print(struct histogram *h, double start, double end) {
|
||||
@@ -194,7 +195,6 @@ void histogram_print(struct histogram *h, double start, double end) {
|
||||
outliercnt=0;
|
||||
fence_lower = 0;
|
||||
fence_upper = 0;
|
||||
@@ -528,23 +568,6 @@ index 93e7578..f6114e2 100644
|
||||
if ((pr->consumer + 1) == pr->maxcount)
|
||||
readindex = 0;
|
||||
else
|
||||
diff --git a/src/sockets.c b/src/sockets.c
|
||||
index ea2190f..f43d8a3 100644
|
||||
--- a/src/sockets.c
|
||||
+++ b/src/sockets.c
|
||||
@@ -295,10 +295,12 @@ bool setsock_blocking (int fd, bool blocking) {
|
||||
unsigned long mode = blocking ? 0 : 1;
|
||||
return (ioctlsocket(fd, FIONBIO, &mode) == 0) ? TRUE : FALSE;
|
||||
#else
|
||||
+{
|
||||
int flags = fcntl(fd, F_GETFL, 0);
|
||||
if (flags < 0) return FALSE;
|
||||
flags = blocking ? (flags&~O_NONBLOCK) : (flags|O_NONBLOCK);
|
||||
return (fcntl(fd, F_SETFL, flags) == 0) ? TRUE : FALSE;
|
||||
+}
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
2.37.3
|
||||
|
||||
Reference in New Issue
Block a user