Make daemon shut down properly
Makes the daemon shutdown properly and adds better start/stop messages.
This commit is contained in:
parent
b8b2dc3b6d
commit
42c26102d8
2 changed files with 22 additions and 2 deletions
|
@ -84,6 +84,10 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
self.max_key_fee = 100.0
|
||||
return defer.succeed(None)
|
||||
|
||||
def _disp_startup():
|
||||
print "Started LBRYnet daemon"
|
||||
return defer.succeed(None)
|
||||
|
||||
d = defer.Deferred()
|
||||
d.addCallback(lambda _: _set_vars())
|
||||
d.addCallback(lambda _: threads.deferToThread(self._setup_data_directory))
|
||||
|
@ -96,10 +100,19 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
d.addCallback(lambda _: self._setup_lbry_file_manager())
|
||||
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
||||
d.addCallback(lambda _: self._setup_fetcher())
|
||||
d.addCallback(lambda _: _disp_startup())
|
||||
d.callback(None)
|
||||
|
||||
return defer.succeed(None)
|
||||
|
||||
def _shutdown(self):
|
||||
print 'Closing lbrynet session'
|
||||
if self.session is not None:
|
||||
d = self.session.shut_down()
|
||||
else:
|
||||
d = defer.Deferred()
|
||||
return d
|
||||
|
||||
def _update_settings(self):
|
||||
self.data_rate = self.session_settings['data_rate']
|
||||
self.max_key_fee = self.session_settings['max_key_fee']
|
||||
|
@ -366,8 +379,14 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
Stop the reactor
|
||||
"""
|
||||
|
||||
reactor.stop()
|
||||
return defer.succeed('Stopping')
|
||||
def _disp_shutdown():
|
||||
print 'Shutting down lbrynet daemon'
|
||||
|
||||
d = self._shutdown()
|
||||
d.addCallback(lambda _: _disp_shutdown())
|
||||
d.addCallback(lambda _: reactor.stop())
|
||||
|
||||
return d
|
||||
|
||||
def xmlrpc_get_lbry_files(self):
|
||||
"""
|
||||
|
|
|
@ -231,6 +231,7 @@ class FetcherDaemon(object):
|
|||
for l in conf:
|
||||
if l.startswith("maxkey="):
|
||||
settings["maxkey"] = float(l[7:].rstrip('\n'))
|
||||
print "Autofetcher using max key price of", settings["maxkey"], ", to start call start_fetcher()"
|
||||
else:
|
||||
print "Autofetcher using default max key price of 0.0"
|
||||
print "To change this create the file:"
|
||||
|
|
Loading…
Reference in a new issue