Adds logging for modem reconnections.
This commit is contained in:
@@ -603,7 +603,6 @@ class Client:
|
|||||||
sleep(2)
|
sleep(2)
|
||||||
print_message("done...")
|
print_message("done...")
|
||||||
|
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
c = "ping {} -I {} -i {} -c {}".format(
|
c = "ping {} -I {} -i {} -c {}".format(
|
||||||
self.config["server"],
|
self.config["server"],
|
||||||
@@ -769,6 +768,12 @@ class Client:
|
|||||||
print_message("Use ws filter: {}".format(ws_filter))
|
print_message("Use ws filter: {}".format(ws_filter))
|
||||||
for n in range(1, self.config["number_of_measurements"] + 1):
|
for n in range(1, self.config["number_of_measurements"] + 1):
|
||||||
if not is_modem_connected():
|
if not is_modem_connected():
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
print_message(
|
print_message(
|
||||||
"{} of {}".format(n, self.config["number_of_measurements"])
|
"{} of {}".format(n, self.config["number_of_measurements"])
|
||||||
@@ -813,12 +818,26 @@ class Client:
|
|||||||
iperf_return = 0
|
iperf_return = 0
|
||||||
while not is_measurement_done or iperf_return != 0:
|
while not is_measurement_done or iperf_return != 0:
|
||||||
if iperf_return != 0:
|
if iperf_return != 0:
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
|
iperf_return = subprocess.call(
|
||||||
|
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
print_message("iPerf timed out...")
|
print_message("iPerf timed out...")
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
exit()
|
exit()
|
||||||
@@ -838,6 +857,12 @@ class Client:
|
|||||||
print_message("tcp probe is now enabled")
|
print_message("tcp probe is now enabled")
|
||||||
for n in range(1, self.config["number_of_measurements"] + 1):
|
for n in range(1, self.config["number_of_measurements"] + 1):
|
||||||
if not is_modem_connected():
|
if not is_modem_connected():
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
print_message(
|
print_message(
|
||||||
"{} of {}".format(n, self.config["number_of_measurements"])
|
"{} of {}".format(n, self.config["number_of_measurements"])
|
||||||
@@ -881,12 +906,26 @@ class Client:
|
|||||||
iperf_return = 0
|
iperf_return = 0
|
||||||
while not is_measurement_done or iperf_return != 0:
|
while not is_measurement_done or iperf_return != 0:
|
||||||
if iperf_return != 0:
|
if iperf_return != 0:
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
|
iperf_return = subprocess.call(
|
||||||
|
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
|
||||||
|
)
|
||||||
except:
|
except:
|
||||||
print_message("iPerf timed out...")
|
print_message("iPerf timed out...")
|
||||||
|
background_write_to_file(
|
||||||
|
filepath="{}{}_reconnect.log".format(
|
||||||
|
self.config["folder"], self.config["prefix"]
|
||||||
|
),
|
||||||
|
content='{}"'.format(datetime.timestamp(datetime.now())),
|
||||||
|
)
|
||||||
reconnect_modem()
|
reconnect_modem()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
exit()
|
exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user