hash announcer fix
This commit is contained in:
parent
eb16cb0aa8
commit
26a3221bac
2 changed files with 4 additions and 3 deletions
|
@ -162,7 +162,7 @@ class GetStream:
|
||||||
def _download(self, sd_blob, name, key_fee, txid, nout, file_name=None):
|
def _download(self, sd_blob, name, key_fee, txid, nout, file_name=None):
|
||||||
self.downloader = yield self._create_downloader(sd_blob, file_name=file_name)
|
self.downloader = yield self._create_downloader(sd_blob, file_name=file_name)
|
||||||
yield self.pay_key_fee(key_fee, name)
|
yield self.pay_key_fee(key_fee, name)
|
||||||
yield self.storage.save_content_claim(self.downloader.stream_hash, "%s:%i" % (txid, nout))
|
yield f2d(self.storage.save_content_claim(self.downloader.stream_hash, "%s:%i" % (txid, nout)))
|
||||||
self.finished_deferred = self.downloader.start()
|
self.finished_deferred = self.downloader.start()
|
||||||
self.downloader.download_manager.progress_manager.wrote_first_data.addCallback(
|
self.downloader.download_manager.progress_manager.wrote_first_data.addCallback(
|
||||||
self.data_downloading_deferred.callback
|
self.data_downloading_deferred.callback
|
||||||
|
|
|
@ -2,6 +2,7 @@ import binascii
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from twisted.internet import defer, task
|
from twisted.internet import defer, task
|
||||||
|
from lbrynet.extras.compat import f2d
|
||||||
from lbrynet import utils, conf
|
from lbrynet import utils, conf
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -38,7 +39,7 @@ class DHTHashAnnouncer:
|
||||||
now = self.clock.seconds()
|
now = self.clock.seconds()
|
||||||
if storing_node_ids:
|
if storing_node_ids:
|
||||||
result = (now, storing_node_ids)
|
result = (now, storing_node_ids)
|
||||||
yield self.storage.update_last_announced_blob(blob_hash, now)
|
yield f2d(self.storage.update_last_announced_blob(blob_hash, now))
|
||||||
log.debug("Stored %s to %i peers", blob_hash[:16], len(storing_node_ids))
|
log.debug("Stored %s to %i peers", blob_hash[:16], len(storing_node_ids))
|
||||||
else:
|
else:
|
||||||
result = (None, [])
|
result = (None, [])
|
||||||
|
@ -82,7 +83,7 @@ class DHTHashAnnouncer:
|
||||||
if not self.dht_node.contacts:
|
if not self.dht_node.contacts:
|
||||||
log.info("Not ready to start announcing hashes")
|
log.info("Not ready to start announcing hashes")
|
||||||
return
|
return
|
||||||
need_reannouncement = yield self.storage.get_blobs_to_announce()
|
need_reannouncement = yield f2d(self.storage.get_blobs_to_announce())
|
||||||
if need_reannouncement:
|
if need_reannouncement:
|
||||||
yield self.immediate_announce(need_reannouncement)
|
yield self.immediate_announce(need_reannouncement)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue