value['t'] = {'t': ''.join(pieces)}
elif len(pieces) <= TORRENT_PIECES:
# Short enough to be stored in a separate key in the DHT
value['t'] = {'t': ''.join(pieces)}
elif len(pieces) <= TORRENT_PIECES:
# Short enough to be stored in a separate key in the DHT
storeDefer = self.dht.storeValue(key, value)
storeDefer.addCallback(self.store_done, hash)
storeDefer = self.dht.storeValue(key, value)
storeDefer.addCallback(self.store_done, hash)
pieces = hash.pieceDigests()
if len(pieces) > DHT_PIECES and len(pieces) <= TORRENT_PIECES:
# Add the piece data key and value to the DHT
pieces = hash.pieceDigests()
if len(pieces) > DHT_PIECES and len(pieces) <= TORRENT_PIECES:
# Add the piece data key and value to the DHT
value = {'t': ''.join(pieces)}
storeDefer = self.dht.storeValue(key, value)
value = {'t': ''.join(pieces)}
storeDefer = self.dht.storeValue(key, value)
def store_torrent_done(self, result, key):
"""Adding the file to the DHT is complete, and so is the workflow."""
def store_torrent_done(self, result, key):
"""Adding the file to the DHT is complete, and so is the workflow."""