add lbry_file_manager to reflector server and add files to it

This commit is contained in:
Kay Kurokawa 2017-11-15 09:12:31 -05:00 committed by Jack Robison
parent 6218df2a92
commit ab667015c4
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF
3 changed files with 7 additions and 3 deletions

View file

@ -314,7 +314,8 @@ class Daemon(AuthJSONRPCServer):
reflector_factory = reflector_server_factory(
self.session.peer_manager,
self.session.blob_manager,
self.stream_info_manager
self.stream_info_manager,
self.lbry_file_manager
)
try:
self.reflector_server_port = reactor.listenTCP(self.reflector_port,

View file

@ -186,7 +186,7 @@ class EncryptedFileManager(object):
def add_lbry_file(self, stream_hash, payment_rate_manager=None, blob_data_rate=None,
download_directory=None, file_name=None):
if not payment_rate_manager:
payment_rate_manager = self.sesion.payment_rate_manager
payment_rate_manager = self.session.payment_rate_manager
rowid = yield self._save_lbry_file(stream_hash, blob_data_rate)
lbry_file = yield self.start_lbry_file(rowid, stream_hash, payment_rate_manager,
blob_data_rate, download_directory,

View file

@ -33,6 +33,7 @@ class ReflectorServer(Protocol):
self.peer = self.factory.peer_manager.get_peer(peer_info.host, peer_info.port)
self.blob_manager = self.factory.blob_manager
self.stream_info_manager = self.factory.stream_info_manager
self.lbry_file_manager = self.factory.lbry_file_manager
self.protocol_version = self.factory.protocol_version
self.received_handshake = False
self.peer_version = None
@ -107,6 +108,7 @@ class ReflectorServer(Protocol):
yield save_sd_info(self.stream_info_manager, sd_info)
yield self.stream_info_manager.save_sd_blob_hash_to_stream(sd_info['stream_hash'],
blob.blob_hash)
yield self.lbry_file_manager.add_lbry_file(sd_info['stream_hash'])
should_announce = True
# if we already have the head blob, set it to be announced now that we know it's
@ -399,10 +401,11 @@ class ReflectorServer(Protocol):
class ReflectorServerFactory(ServerFactory):
protocol = ReflectorServer
def __init__(self, peer_manager, blob_manager, stream_info_manager):
def __init__(self, peer_manager, blob_manager, stream_info_manager, lbry_file_manager):
self.peer_manager = peer_manager
self.blob_manager = blob_manager
self.stream_info_manager = stream_info_manager
self.lbry_file_manager = lbry_file_manager
self.protocol_version = REFLECTOR_V2
def buildProtocol(self, addr):