From 0008d471d062cde613893dc1be91c1aeb7fc6fcf Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 14 Oct 2023 11:38:42 +0100 Subject: [PATCH] Fix signal handler --- bridge_master.py | 6 +++--- hotspot_proxy_v2.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 101e11a..8e46188 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -2747,10 +2747,10 @@ if __name__ == '__main__': except KeyError: pass + #install signal handlers + signal.signal(signal.SIGTERM, sig_handler) + signal.signal(signal.SIGINT, sig_handler) - # Set signal handers so that we can gracefully exit if need be - for sig in [signal.SIGINT, signal.SIGTERM]: - signal.signal(sig, sig_handler) # Create the name-number mapping dictionaries peer_ids, subscriber_ids, talkgroup_ids, local_subscriber_ids, server_ids, checksums = mk_aliases(CONFIG) diff --git a/hotspot_proxy_v2.py b/hotspot_proxy_v2.py index 0fb544d..03ce5c0 100644 --- a/hotspot_proxy_v2.py +++ b/hotspot_proxy_v2.py @@ -362,9 +362,9 @@ if __name__ == '__main__': print('(GLOBAL) SHUTDOWN: PROXY IS TERMINATING WITH SIGNAL {}'.format(str(_signal))) reactor.stop() - # Set signal handers so that we can gracefully exit if need be - for sig in [signal.SIGINT, signal.SIGTERM]: - signal.signal(sig, sig_handler) + #Install signal handlers + signal.signal(signal.SIGTERM, sig_handler) + signal.signal(signal.SIGINT, sig_handler) #readState()