From c425b973a066d55b5ccf23e6446da02868053da4 Mon Sep 17 00:00:00 2001 From: bytedream Date: Mon, 31 Jan 2022 20:11:41 +0100 Subject: [PATCH] Added force stop --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 253b9cd..31a646a 100644 --- a/main.py +++ b/main.py @@ -135,7 +135,12 @@ def v1(): PingRequester('192.168.2.1', 'data/192-168-2-1.csv') ] + sig_received = False + def stop(sig, frame): + if sig_received: + exit(1) + print("Stopping threads gratefully (may take up to 60 seconds)") for thread in threads: thread.finish() @@ -155,6 +160,9 @@ def v2(): '1.1.1.1', '217.237.148.22', '192.168.2.1') def stop(sig, frame): + if ping.stop: + exit(1) + print("Stopping process gratefully (may take up to 60 seconds)") ping.finish()