From 4e5ff49177d26e03a4244936e748c4eb070bc464 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 19 Jul 2017 11:42:17 -0400 Subject: [PATCH] fix allowed_during_startup --- CHANGELOG.md | 1 + lbrynet/daemon/Daemon.py | 7 ++++--- lbrynet/daemon/DaemonCLI.py | 4 +++- lbrynet/daemon/auth/server.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1876eede6..b124196b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ at anytime. * Fixed daemon process hanging when started without an internet connection * Fixed https://github.com/lbryio/lbry/issues/774 * Fix XDG compliance on Linux + * Fixed https://github.com/lbryio/lbry/issues/760 ### Deprecated * diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 9fb624e74..96f3968fe 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -165,11 +165,12 @@ class Daemon(AuthJSONRPCServer): LBRYnet daemon, a jsonrpc interface to lbry functions """ + allowed_during_startup = [ + 'daemon_stop', 'status', 'version', + ] + def __init__(self, root, analytics_manager): AuthJSONRPCServer.__init__(self, conf.settings['use_auth_http']) - self.allowed_during_startup = [ - 'stop', 'status', 'version', - ] self.db_dir = conf.settings['data_dir'] self.download_directory = conf.settings['download_directory'] if conf.settings['BLOBFILES_DIR'] == "blobfiles": diff --git a/lbrynet/daemon/DaemonCLI.py b/lbrynet/daemon/DaemonCLI.py index e58ffbab9..906afb96b 100644 --- a/lbrynet/daemon/DaemonCLI.py +++ b/lbrynet/daemon/DaemonCLI.py @@ -82,7 +82,9 @@ def main(): suggest_help=False) return 1 - if status['startup_status']['code'] != "started": + status_code = status['startup_status']['code'] + + if status_code != "started" and method not in Daemon.allowed_during_startup: print "Daemon is in the process of starting. Please try again in a bit." message = status['startup_status']['message'] if message: diff --git a/lbrynet/daemon/auth/server.py b/lbrynet/daemon/auth/server.py index cf1cdad5c..05c39799a 100644 --- a/lbrynet/daemon/auth/server.py +++ b/lbrynet/daemon/auth/server.py @@ -192,6 +192,7 @@ class AuthJSONRPCServer(AuthorizedBase): implements(resource.IResource) isLeaf = True + allowed_during_startup = [] def __init__(self, use_authentication=None): self._call_lock = {} @@ -199,7 +200,6 @@ class AuthJSONRPCServer(AuthorizedBase): use_authentication if use_authentication is not None else conf.settings['use_auth_http'] ) self.announced_startup = False - self.allowed_during_startup = [] self.sessions = {} def setup(self):