diff options
Diffstat (limited to 'service.py')
-rwxr-xr-x | service.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -13,7 +13,7 @@ from session import Session from trigger import TriggerServerThread ONE_TIME_SERVICE = False - +ALLOW_ONLY_ONE_SESSION = True class RWAService(dbus.service.Object): def __init__(self, loop, mockup_mode: bool = False): @@ -33,6 +33,9 @@ class RWAService(dbus.service.Object): @dbus.service.method("org.ArcticaProject.RWA", out_signature="s") def start(self): """Start a new remote session.""" + if ALLOW_ONLY_ONE_SESSION and len(self.sessions.values()) > 0: + return json.dumps({"status": "error"}) + # Start session session = Session(self.trigger_service.port, mockup_mode) @@ -42,7 +45,10 @@ class RWAService(dbus.service.Object): # Start session update service self._ensure_update_service() - return json.dumps(session.client_meta) + return_json = session.client_meta + return_json["status"] = "success" + + return json.dumps(return_json) @dbus.service.method("org.ArcticaProject.RWA", in_signature="i", out_signature="s") def status(self, pid: int) -> str: |