diff --git a/CHANGELOG.md b/CHANGELOG.md index 0410ed0ca..5835cb390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ at anytime. ### Fixed * * + * Fixed incorrect formatting of "amount" fields + * Fixed handling of SIGINT, SIGTERM. + * Fixed shutdown sequence ### Deprecated * The API will no longer be served at the /lbryapi path. It will now be at the root. diff --git a/lbrynet/daemon/DaemonControl.py b/lbrynet/daemon/DaemonControl.py index d16492ed6..c5abca464 100644 --- a/lbrynet/daemon/DaemonControl.py +++ b/lbrynet/daemon/DaemonControl.py @@ -18,18 +18,8 @@ def test_internet_connection(): return utils.check_connection() -def stop(): - conf.initialize_settings() - log_support.configure_console() - try: - LBRYAPIClient.get_client().call('stop') - except Exception: - log.exception('Failed to stop deamon') - else: - log.info("Shutting down lbrynet-daemon from command line") - - def start(): + """The primary entry point for launching the daemon.""" conf.initialize_settings() parser = argparse.ArgumentParser(description="Launch lbrynet-daemon") @@ -107,10 +97,9 @@ def start_server_and_listen(use_auth, analytics_manager): yield daemon_server.start(use_auth) analytics_manager.send_server_startup_success() except Exception as e: - log.exception('Failed to startup') - yield daemon_server.stop() + log.exception('Failed to start') analytics_manager.send_server_startup_error(str(e)) - reactor.fireSystemEvent("shutdown") + daemon_server.stop() if __name__ == "__main__": diff --git a/lbrynet/daemon/DaemonServer.py b/lbrynet/daemon/DaemonServer.py index 98c340d71..578c3b0a6 100644 --- a/lbrynet/daemon/DaemonServer.py +++ b/lbrynet/daemon/DaemonServer.py @@ -54,10 +54,9 @@ class DaemonServer(object): @defer.inlineCallbacks def stop(self): - if self._api is not None: - yield self._api._shutdown() - if self.server_port is not None: - yield self.server_port.stopListening() + if reactor.running: + log.info("Stopping the reactor") + reactor.fireSystemEvent("shutdown") def get_site_base(use_auth, root):