Daemon: Replace get_server with request.
This function performs a single RPC, and may raise a DaemonNotRunning exception.
This commit is contained in:
23
run_electrum
23
run_electrum
@@ -364,8 +364,7 @@ if __name__ == '__main__':
|
||||
d.init_gui(config, plugins)
|
||||
sys.exit(0)
|
||||
else:
|
||||
server = daemon.get_server()
|
||||
result = server.gui(config_options)
|
||||
result = daemon.request(config, 'gui', config_options)
|
||||
|
||||
elif cmdname == 'daemon':
|
||||
subcommand = config.get('subcommand')
|
||||
@@ -405,27 +404,25 @@ if __name__ == '__main__':
|
||||
d.join()
|
||||
sys.exit(0)
|
||||
else:
|
||||
server = daemon.get_server(config)
|
||||
result = server.daemon(config_options)
|
||||
result = daemon.request(config, 'daemon', config_options)
|
||||
else:
|
||||
server = daemon.get_server(config)
|
||||
if server is not None:
|
||||
result = server.daemon(config_options)
|
||||
else:
|
||||
try:
|
||||
result = daemon.request(config, 'daemon', config_options)
|
||||
except daemon.DaemonNotRunning:
|
||||
print_msg("Daemon not running")
|
||||
sys.exit(1)
|
||||
else:
|
||||
# command line
|
||||
server = daemon.get_server(config)
|
||||
init_cmdline(config_options, server)
|
||||
if server is not None:
|
||||
result = server.run_cmdline(config_options)
|
||||
else:
|
||||
try:
|
||||
init_cmdline(config_options, True)
|
||||
result = daemon.request(config, 'run_cmdline', config_options)
|
||||
except daemon.DaemonNotRunning:
|
||||
cmd = known_commands[cmdname]
|
||||
if cmd.requires_network:
|
||||
print_msg("Daemon not running; try 'electrum daemon start'")
|
||||
sys.exit(1)
|
||||
else:
|
||||
init_cmdline(config_options, False)
|
||||
plugins = init_plugins(config, 'cmdline')
|
||||
result = run_offline_command(config, config_options, plugins)
|
||||
# print result
|
||||
|
||||
Reference in New Issue
Block a user