@@ -358,6 +358,7 @@ iperf_handle_message_client(struct iperf_test *test)
358
358
case TEST_RUNNING :
359
359
break ;
360
360
case EXCHANGE_RESULTS :
361
+ iperf_cancel_periodic_timers (test );
361
362
if (iperf_exchange_results (test ) < 0 )
362
363
return -1 ;
363
364
break ;
@@ -607,7 +608,7 @@ iperf_run_client(struct iperf_test * test)
607
608
608
609
/* Begin calculating CPU utilization */
609
610
cpu_util (NULL );
610
- if (test -> mode != SENDER )
611
+ if (test -> mode != SENDER || test -> state != TEST_RUNNING )
611
612
rcv_timeout_us = (test -> settings -> rcv_timeout .secs * SEC_TO_US ) + test -> settings -> rcv_timeout .usecs ;
612
613
else
613
614
rcv_timeout_us = 0 ;
@@ -622,16 +623,16 @@ iperf_run_client(struct iperf_test * test)
622
623
iperf_time_now (& now );
623
624
timeout = tmr_timeout (& now );
624
625
625
- // In reverse active mode client ensures data is received
626
- if (test -> state == TEST_RUNNING && rcv_timeout_us > 0 ) {
626
+ // In non-sending active mode or not during active test, client ensures data םor control messages are received
627
+ if (rcv_timeout_us > 0 ) {
627
628
timeout_us = -1 ;
628
629
if (timeout != NULL ) {
629
630
used_timeout .tv_sec = timeout -> tv_sec ;
630
631
used_timeout .tv_usec = timeout -> tv_usec ;
631
632
timeout_us = (timeout -> tv_sec * SEC_TO_US ) + timeout -> tv_usec ;
632
633
}
633
- /* Cap the maximum select timeout at 1 second */
634
- if (timeout_us > SEC_TO_US ) {
634
+ /* Cap the maximum select timeout at 1 second during active test */
635
+ if (test -> state == TEST_RUNNING && timeout_us > SEC_TO_US ) {
635
636
timeout_us = SEC_TO_US ;
636
637
}
637
638
if (timeout_us < 0 || timeout_us > rcv_timeout_us ) {
@@ -641,6 +642,8 @@ iperf_run_client(struct iperf_test * test)
641
642
timeout = & used_timeout ;
642
643
}
643
644
645
+ if (timeout ) timeout_us = (timeout -> tv_sec * SEC_TO_US ) + timeout -> tv_usec ;
646
+
644
647
#if (defined(__vxworks )) || (defined(__VXWORKS__ ))
645
648
if (timeout != NULL && timeout -> tv_sec == 0 && timeout -> tv_usec == 0 ) {
646
649
taskDelay (1 );
@@ -657,23 +660,32 @@ iperf_run_client(struct iperf_test * test)
657
660
if (result < 0 && errno != EINTR ) {
658
661
i_errno = IESELECT ;
659
662
goto cleanup_and_fail ;
660
- } else if (result == 0 && test -> state == TEST_RUNNING && rcv_timeout_us > 0 ) {
663
+ } else if (result == 0 && rcv_timeout_us > 0 ) {
661
664
/*
662
- * If nothing was received in non-reverse running state
663
- * then probably something got stuck - either client,
664
- * server or network, and test should be terminated./
665
+ * If nothing was received then probably something got stuck -
666
+ * either client, server or network, and test should be terminated.
665
667
*/
666
668
iperf_time_now (& now );
667
- if (iperf_time_diff (& now , & last_receive_time , & diff_time ) == 0 ) {
668
- t_usecs = iperf_time_in_usecs (& diff_time );
669
- if (t_usecs > rcv_timeout_us ) {
670
- /* Idle timeout if no new blocks received */
671
- if (test -> blocks_received == last_receive_blocks ) {
672
- i_errno = IENOMSG ;
673
- goto cleanup_and_fail ;
669
+ if (test -> state == TEST_RUNNING && test -> mode != SENDER ) { // Check if data is received
670
+ if (iperf_time_diff (& now , & last_receive_time , & diff_time ) == 0 ) {
671
+ t_usecs = iperf_time_in_usecs (& diff_time );
672
+ if (t_usecs > rcv_timeout_us ) {
673
+ /* Idle timeout if no new blocks received */
674
+ if (test -> blocks_received == last_receive_blocks ) {
675
+ if (test -> debug_level >= DEBUG_LEVEL_INFO ) {
676
+ iperf_printf (test , "Receiving data blocks timed out\n" );
677
+ }
678
+ i_errno = IENOMSG ;
679
+ goto cleanup_and_fail ;
680
+ }
674
681
}
675
682
}
676
-
683
+ } else if (test -> state != TEST_RUNNING && rcv_timeout_us == timeout_us ) { // Check if control messages are received
684
+ if (test -> debug >= DEBUG_LEVEL_INFO ) {
685
+ iperf_printf (test , "Receiving control messages timed out\n" );
686
+ }
687
+ i_errno = IENOMSG ;
688
+ goto cleanup_and_fail ;
677
689
}
678
690
}
679
691
0 commit comments