fix disabling the hash announcer

This commit is contained in:
Jack Robison 2018-08-09 12:04:14 -04:00
parent 90a119bb2c
commit 2804fa4448
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -15,17 +15,22 @@ class DHTHashAnnouncer(object):
self.clock = dht_node.clock
self.peer_port = dht_node.peerPort
self.hash_queue = []
self.concurrent_announcers = concurrent_announcers or conf.settings['concurrent_announcers']
self._manage_lc = task.LoopingCall(self.manage)
self._manage_lc.clock = self.clock
self.sem = defer.DeferredSemaphore(self.concurrent_announcers)
if concurrent_announcers is None:
self.concurrent_announcers = conf.settings['concurrent_announcers']
else:
self.concurrent_announcers = concurrent_announcers
self._manage_lc = None
if self.concurrent_announcers:
self._manage_lc = task.LoopingCall(self.manage)
self._manage_lc.clock = self.clock
self.sem = defer.DeferredSemaphore(self.concurrent_announcers or conf.settings['concurrent_announcers'] or 1)
def start(self):
if self.concurrent_announcers:
if self._manage_lc:
self._manage_lc.start(30)
def stop(self):
if self._manage_lc.running:
if self._manage_lc and self._manage_lc.running:
self._manage_lc.stop()
@defer.inlineCallbacks