Browse Source

Handle JSON RPC server timeouts differently

Prior method was causing issues on Python 2.7.10 on DragonFlyBSD at
least.
283
Neil Booth 9 years ago
parent
commit
03b4868bf8
  1. 9
      lib/daemon.py

9
lib/daemon.py

@ -70,7 +70,7 @@ class Daemon(util.DaemonThread):
host = config.get('rpchost', 'localhost') host = config.get('rpchost', 'localhost')
port = config.get('rpcport', 7777) port = config.get('rpcport', 7777)
self.server = SimpleJSONRPCServer((host, port), requestHandler=RequestHandler, logRequests=False) self.server = SimpleJSONRPCServer((host, port), requestHandler=RequestHandler, logRequests=False)
self.server.socket.settimeout(1) self.server.timeout = 1.0
for cmdname in known_commands: for cmdname in known_commands:
self.server.register_function(getattr(self.cmd_runner, cmdname), cmdname) self.server.register_function(getattr(self.cmd_runner, cmdname), cmdname)
self.server.register_function(self.run_cmdline, 'run_cmdline') self.server.register_function(self.run_cmdline, 'run_cmdline')
@ -149,12 +149,7 @@ class Daemon(util.DaemonThread):
def run(self): def run(self):
while self.is_running(): while self.is_running():
try: self.server.handle_request()
self.server.handle_request()
except socket.timeout:
continue
except:
break
def stop(self): def stop(self):
for k, wallet in self.wallets.items(): for k, wallet in self.wallets.items():

Loading…
Cancel
Save