Adds iperf timeout for bandwith measurements.
This commit is contained in:
@@ -328,6 +328,10 @@ class Server:
|
|||||||
if self.config["set"]["alternate_hystart"] == "true":
|
if self.config["set"]["alternate_hystart"] == "true":
|
||||||
alternate_hystart = True
|
alternate_hystart = True
|
||||||
|
|
||||||
|
time = "10"
|
||||||
|
if "time" in self.config["set"]:
|
||||||
|
time = self.config["set"]["time"]
|
||||||
|
|
||||||
# prevent address already in use
|
# prevent address already in use
|
||||||
sleep(2)
|
sleep(2)
|
||||||
ws_filter = ""
|
ws_filter = ""
|
||||||
@@ -364,7 +368,10 @@ class Server:
|
|||||||
self.config["server"],
|
self.config["server"],
|
||||||
self.config["port"],
|
self.config["port"],
|
||||||
)
|
)
|
||||||
subprocess.call(iperf_command)
|
try:
|
||||||
|
subprocess.call(iperf_command, timeout=time + 1)
|
||||||
|
except:
|
||||||
|
print_message("iPerf timed out. Going ahead with next measurement...")
|
||||||
processHandler.kill_all()
|
processHandler.kill_all()
|
||||||
congestion_control_index = (congestion_control_index + 1) % len(
|
congestion_control_index = (congestion_control_index + 1) % len(
|
||||||
tcp_algo
|
tcp_algo
|
||||||
@@ -433,7 +440,10 @@ class Server:
|
|||||||
str(self.config["port"]),
|
str(self.config["port"]),
|
||||||
"--one-off",
|
"--one-off",
|
||||||
]
|
]
|
||||||
subprocess.call(iperf_command)
|
try:
|
||||||
|
subprocess.call(iperf_command, timeout=time + 1)
|
||||||
|
except:
|
||||||
|
print_message("iPerf timed out. Going ahead with next measurement...")
|
||||||
sleep(2)
|
sleep(2)
|
||||||
processHandler.kill_all()
|
processHandler.kill_all()
|
||||||
congestion_control_index = (congestion_control_index + 1) % len(
|
congestion_control_index = (congestion_control_index + 1) % len(
|
||||||
@@ -546,7 +556,10 @@ class Client:
|
|||||||
)
|
)
|
||||||
ser_thread.start()
|
ser_thread.start()
|
||||||
|
|
||||||
|
gps_ser = None
|
||||||
|
|
||||||
if self.config["gps"] is not None:
|
if self.config["gps"] is not None:
|
||||||
|
print_message("Opening GPS serial port for {}".format(self.config["gps"]))
|
||||||
gps_ser = serial.Serial(
|
gps_ser = serial.Serial(
|
||||||
self.config["gps"],
|
self.config["gps"],
|
||||||
baudrate=self.config["gps_baudrate"],
|
baudrate=self.config["gps_baudrate"],
|
||||||
@@ -581,6 +594,12 @@ class Client:
|
|||||||
ser.close()
|
ser.close()
|
||||||
sleep(2)
|
sleep(2)
|
||||||
print_message("done...")
|
print_message("done...")
|
||||||
|
if gps_ser is not None:
|
||||||
|
print_message("Closing GPS serial port...")
|
||||||
|
gps_ser.close()
|
||||||
|
sleep(2)
|
||||||
|
print_message("done...")
|
||||||
|
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
c = "ping {} -I {} -i {} -c {}".format(
|
c = "ping {} -I {} -i {} -c {}".format(
|
||||||
@@ -787,7 +806,10 @@ class Client:
|
|||||||
"-C",
|
"-C",
|
||||||
tcp_algo[congestion_control_index],
|
tcp_algo[congestion_control_index],
|
||||||
]
|
]
|
||||||
subprocess.call(iperf_command)
|
try:
|
||||||
|
subprocess.call(iperf_command, timeout=time + 2)
|
||||||
|
except:
|
||||||
|
print_message("iPerf timed out. Going ahead with next measurement...")
|
||||||
sleep(4)
|
sleep(4)
|
||||||
processHandler.kill_all()
|
processHandler.kill_all()
|
||||||
congestion_control_index = (congestion_control_index + 1) % len(
|
congestion_control_index = (congestion_control_index + 1) % len(
|
||||||
@@ -842,7 +864,10 @@ class Client:
|
|||||||
self.config["port"],
|
self.config["port"],
|
||||||
)
|
)
|
||||||
sleep(2)
|
sleep(2)
|
||||||
subprocess.call(iperf_command)
|
try:
|
||||||
|
subprocess.call(iperf_command, timeout=time+2)
|
||||||
|
except:
|
||||||
|
print_message("iPerf timed out. Going ahead with next measurement...")
|
||||||
processHandler.kill_all()
|
processHandler.kill_all()
|
||||||
congestion_control_index = (congestion_control_index + 1) % len(
|
congestion_control_index = (congestion_control_index + 1) % len(
|
||||||
tcp_algo
|
tcp_algo
|
||||||
|
|||||||
Reference in New Issue
Block a user