aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Weth <mail@jonathanweth.de>2021-06-28 10:18:37 +0000
committerJonathan Weth <mail@jonathanweth.de>2021-06-28 10:18:37 +0000
commit0874724d59f297518424dee96f26bdaa000faa08 (patch)
tree718122bf216088cc737eea2198f264ee83c7b8f6
parentd81082efdea8b603914f04b6690d11c28fc8fcf7 (diff)
parent7a8879367414be332ad0946c2b37348d5f4fef9d (diff)
downloadRWA.Support.SessionService-0874724d59f297518424dee96f26bdaa000faa08.tar.gz
RWA.Support.SessionService-0874724d59f297518424dee96f26bdaa000faa08.tar.bz2
RWA.Support.SessionService-0874724d59f297518424dee96f26bdaa000faa08.zip
Merge branch 'mr/sigquit-handler-for-stopping-sessions' into 'master'
Add a new signal handler for SIGQUIT See merge request remotewebapp/rwa.support.sessionservice!6
-rwxr-xr-xrwa/support/sessionservice/service.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/rwa/support/sessionservice/service.py b/rwa/support/sessionservice/service.py
index 3e9900d..6988beb 100755
--- a/rwa/support/sessionservice/service.py
+++ b/rwa/support/sessionservice/service.py
@@ -251,11 +251,16 @@ class RWASupportSessionService(dbus.service.Object):
return False
def _stop_all(self):
- """Stop all sessions and this daemon."""
- logging.info("Stop all sessions and exit service.")
+ """Stop all sessions"""
+ logging.info("Stop all sessions.")
for session in list(self.sessions.values()):
session.stop()
del self.sessions[session.pid]
+
+ def _stop_daemon(self):
+ """Stop all sessions and this daemon."""
+ logging.info("Shut down session service.")
+ self._stop_all()
self.trigger_service.shutdown()
self.loop.quit()
@@ -317,11 +322,16 @@ def main(mockup, once):
loop = GLib.MainLoop()
service_object = RWASupportSessionService(loop, mockup, once)
- def signal_handler(sig, frame):
+ def sigint_handler(sig, frame):
logging.info("Service was terminated.")
+ service_object._stop_daemon()
+
+ def sigquit_handler(sig, frame):
+ logging.info("Session was terminated.")
service_object._stop_all()
- signal.signal(signal.SIGINT, signal_handler)
+ signal.signal(signal.SIGINT, sigint_handler)
+ signal.signal(signal.SIGQUIT, sigquit_handler)
loop.run()