tmove daemon_timeout out of server class - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 914c115617b2543603ebe13bba0e520d4ecec91d DIR parent f7280e46374c442570a2f6b8a97f19a4a1b8944c HTML Author: ThomasV <thomasv@gitorious> Date: Tue, 29 Jul 2014 10:52:28 +0200 move daemon_timeout out of server class Diffstat: M lib/daemon.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- DIR diff --git a/lib/daemon.py b/lib/daemon.py t@@ -116,8 +116,6 @@ class NetworkServer(threading.Thread): self.network_queue = Queue.Queue() self.running = False - # daemon terminates after period of inactivity - self.timeout = config.get('daemon_timeout', 5*60) self.lock = threading.RLock() # each GUI is a client of the daemon t@@ -167,6 +165,7 @@ def daemon_loop(server): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) daemon_port = server.config.get('daemon_port', DAEMON_PORT) + daemon_timeout = server.config.get('daemon_timeout', 5*60) s.bind(('', daemon_port)) s.listen(5) s.settimeout(1) t@@ -176,7 +175,7 @@ def daemon_loop(server): connection, address = s.accept() except socket.timeout: if not server.clients: - if time.time() - t > server.timeout: + if time.time() - t > daemon_timeout: print_error("Daemon timeout") break else: