@@ -1922,7 +1922,7 @@ iperf_check_throttle(struct iperf_stream *sp, struct iperf_time *nowP)
1922
1922
delta_bits = bits_sent - (seconds * sp -> test -> settings -> rate );
1923
1923
// Calclate time until next data send is required
1924
1924
time_to_green_light = (SEC_TO_NS * delta_bits / sp -> test -> settings -> rate );
1925
- // Whether shouuld wait before next send
1925
+ // Whether should wait before next send
1926
1926
if (time_to_green_light >= 0 ) {
1927
1927
#if defined(HAVE_CLOCK_NANOSLEEP )
1928
1928
if (clock_gettime (CLOCK_MONOTONIC , & nanosleep_time ) == 0 ) {
@@ -2006,6 +2006,9 @@ iperf_send_mt(struct iperf_stream *sp)
2006
2006
register struct iperf_test * test = sp -> test ;
2007
2007
struct iperf_time now ;
2008
2008
int throttle_check_per_message ;
2009
+ #if defined(HAVE_CLOCK_NANOSLEEP ) || defined(HAVE_NANOSLEEP )
2010
+ int throttle_check ;
2011
+ #endif /* HAVE_CLOCK_NANOSLEEP, HAVE_NANOSLEEP */
2009
2012
2010
2013
/* Can we do multisend mode? */
2011
2014
if (test -> settings -> burst != 0 )
@@ -2016,7 +2019,20 @@ iperf_send_mt(struct iperf_stream *sp)
2016
2019
multisend = 1 ; /* nope */
2017
2020
2018
2021
/* Should bitrate throttle be checked for every send */
2022
+ #if defined(HAVE_CLOCK_NANOSLEEP ) || defined(HAVE_NANOSLEEP )
2023
+ if (test -> settings -> rate != 0 ) {
2024
+ throttle_check = 1 ;
2025
+ if (test -> settings -> burst == 0 )
2026
+ throttle_check_per_message = 1 ;
2027
+ else
2028
+ throttle_check_per_message = 0 ;
2029
+ } else {
2030
+ throttle_check = 0 ;
2031
+ throttle_check_per_message = 0 ;
2032
+ }
2033
+ #else /* !HAVE_CLOCK_NANOSLEEP && !HAVE_NANOSLEEP */
2019
2034
throttle_check_per_message = test -> settings -> rate != 0 && test -> settings -> burst == 0 ;
2035
+ #endif /* HAVE_CLOCK_NANOSLEEP, HAVE_NANOSLEEP */
2020
2036
2021
2037
for (message_sent = 0 ; sp -> green_light && multisend > 0 ; -- multisend ) {
2022
2038
// XXX If we hit one of these ending conditions maybe
@@ -2042,7 +2058,8 @@ iperf_send_mt(struct iperf_stream *sp)
2042
2058
message_sent = 1 ;
2043
2059
}
2044
2060
#if defined(HAVE_CLOCK_NANOSLEEP ) || defined(HAVE_NANOSLEEP )
2045
- if (!sp -> green_light ) { /* Should check if green ligh can be set, as pacing timer is not supported in this case */
2061
+ /* Should check if green light can be set, as pacing timer is not supported in this case */
2062
+ if (throttle_check && !throttle_check_per_message ) {
2046
2063
#else /* !HAVE_CLOCK_NANOSLEEP && !HAVE_NANOSLEEP */
2047
2064
if (!throttle_check_per_message || message_sent == 0 ) { /* Throttle check if was not checked for each send */
2048
2065
#endif /* HAVE_CLOCK_NANOSLEEP, HAVE_NANOSLEEP */
0 commit comments