From f56e6788d5e4b249e3d6977846e854bd23730778 Mon Sep 17 00:00:00 2001 From: Lukas Prause Date: Fri, 14 Oct 2022 13:35:47 +0200 Subject: [PATCH] Adds iperf timeout for bandwith measurements. --- measurement_main.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/measurement_main.py b/measurement_main.py index 1a7c5e5..7f5cb61 100755 --- a/measurement_main.py +++ b/measurement_main.py @@ -371,10 +371,11 @@ class Server: self.config["port"], ) is_measurement_done = False - while not is_measurement_done: + return_code = 0 + while not is_measurement_done or return_code != 0: try: try: - subprocess.call(iperf_command, timeout=float(time) + 1.0 + TIMEOUT_OFFSET) + return_code = subprocess.call(iperf_command, timeout=float(time) + 1.0 + TIMEOUT_OFFSET) is_measurement_done = True except: print_message("iPerf timed out. Retry...") @@ -449,10 +450,11 @@ class Server: "--one-off", ] is_measurement_done = False - while not is_measurement_done: + return_code = 0 + while not is_measurement_done or return_code != 0: try: try: - subprocess.call(iperf_command, timeout=float(time) + 1.0 + TIMEOUT_OFFSET) + return_code= subprocess.call(iperf_command, timeout=float(time) + 1.0 + TIMEOUT_OFFSET) is_measurement_done = True except: print_message("iPerf timed out. Retry...") @@ -821,10 +823,11 @@ class Client: tcp_algo[congestion_control_index], ] is_measurement_done = False - while not is_measurement_done: + return_code = 0 + while not is_measurement_done or return_code != 0: try: try: - subprocess.call(iperf_command, timeout=float(time) + 2.0 + TIMEOUT_OFFSET) + return_code = subprocess.call(iperf_command, timeout=float(time) + 2.0 + TIMEOUT_OFFSET) is_measurement_done = True except: print_message("iPerf timed out. Retry...") @@ -885,10 +888,11 @@ class Client: ) sleep(2) is_measurement_done = False - while not is_measurement_done: + return_code = 0 + while not is_measurement_done or return_code != 0: try: try: - subprocess.call(iperf_command, timeout=float(time) + 2.0 + TIMEOUT_OFFSET) + return_code = subprocess.call(iperf_command, timeout=float(time) + 2.0 + TIMEOUT_OFFSET) is_measurement_done = True except: print_message("iPerf timed out. Retry...")