diff options
Diffstat (limited to 'module/remote/RemoteManager.py')
-rw-r--r-- | module/remote/RemoteManager.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/module/remote/RemoteManager.py b/module/remote/RemoteManager.py index 2ac26a677..6caedad90 100644 --- a/module/remote/RemoteManager.py +++ b/module/remote/RemoteManager.py @@ -24,14 +24,19 @@ class BackendBase(Thread): Thread.__init__(self) self.m = manager self.core = manager.core + self.enabled = True + self.running = False def run(self): + self.running = True try: self.serve() except Exception, e: self.core.log.error(_("Remote backend error: %s") % e) if self.core.debug: print_exc() + finally: + self.running = False def setup(self, host, port): pass @@ -42,14 +47,27 @@ class BackendBase(Thread): def serve(self): pass + def shutdown(self): + pass + + def stop(self): + self.enabled = False# set flag and call shutdowm message, so thread can react + self.shutdown() + class RemoteManager(): - available = ["ThriftBackend"] + available = [] def __init__(self, core): self.core = core self.backends = [] + if self.core.remote: + self.available.append("ThriftBackend") + else: + self.available.append("SocketBackend") + + def startBackends(self): host = self.core.config["remote"]["listenaddr"] port = self.core.config["remote"]["port"] |