commit 03b4868bf84340ba0d5c847e3eec07b227f123d6
parent c3bd9226f2399f97bbfbeaae2b53794f1cc76fa5
Author: Neil Booth <kyuupichan@gmail.com>
Date: Sat, 5 Dec 2015 21:30:37 +0900
Handle JSON RPC server timeouts differently
Prior method was causing issues on Python 2.7.10 on DragonFlyBSD at
least.
Diffstat:
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git 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():