From 03b4868bf84340ba0d5c847e3eec07b227f123d6 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sat, 5 Dec 2015 21:30:37 +0900 Subject: [PATCH] Handle JSON RPC server timeouts differently Prior method was causing issues on Python 2.7.10 on DragonFlyBSD at least. --- lib/daemon.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/daemon.py b/lib/daemon.py index 103209286..253ea8c9b 100644 --- a/lib/daemon.py +++ b/lib/daemon.py @@ -70,7 +70,7 @@ class Daemon(util.DaemonThread): host = config.get('rpchost', 'localhost') port = config.get('rpcport', 7777) self.server = SimpleJSONRPCServer((host, port), requestHandler=RequestHandler, logRequests=False) - self.server.socket.settimeout(1) + self.server.timeout = 1.0 for cmdname in known_commands: self.server.register_function(getattr(self.cmd_runner, cmdname), cmdname) self.server.register_function(self.run_cmdline, 'run_cmdline') @@ -149,12 +149,7 @@ class Daemon(util.DaemonThread): def run(self): while self.is_running(): - try: - self.server.handle_request() - except socket.timeout: - continue - except: - break + self.server.handle_request() def stop(self): for k, wallet in self.wallets.items():