| 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 = "" | ||||
| 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 | ||||
| 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( | ||||
| ) | ) | ||||
| 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"], | ||||
| 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( | ||||
| "-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( | ||||
| 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 |