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()