forked from LBRYCommunity/lbry-sdk
move run_reflector_server into settings file and add debug lines
This commit is contained in:
parent
d6f902653f
commit
132aa569fe
3 changed files with 8 additions and 3 deletions
|
@ -175,9 +175,6 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
self.first_run_after_update = False
|
||||
self.uploaded_temp_files = []
|
||||
|
||||
# change this to enable reflector server
|
||||
self.run_reflector_server = False
|
||||
|
||||
if os.name == "nt":
|
||||
from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle
|
||||
default_download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
|
||||
|
@ -216,6 +213,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
'use_upnp': True,
|
||||
'start_lbrycrdd': True,
|
||||
'requested_first_run_credits': False,
|
||||
'run_reflector_server': False,
|
||||
'cache_time': DEFAULT_CACHE_TIME,
|
||||
'startup_scripts': [],
|
||||
'last_version': {'lbrynet': lbrynet_version, 'lbryum': lbryum_version}
|
||||
|
@ -275,6 +273,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
self.search_timeout = self.session_settings['search_timeout']
|
||||
self.download_timeout = self.session_settings['download_timeout']
|
||||
self.max_search_results = self.session_settings['max_search_results']
|
||||
self.run_reflector_server = self.session_settings['run_reflector_server']
|
||||
####
|
||||
#
|
||||
# Ignore the saved wallet type. Some users will have their wallet type
|
||||
|
@ -684,6 +683,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
|
||||
def _start_reflector(self):
|
||||
if self.run_reflector_server:
|
||||
log.info("Starting reflector server")
|
||||
if self.reflector_port is not None:
|
||||
reflector_factory = reflector.ServerFactory(
|
||||
self.session.peer_manager,
|
||||
|
@ -698,6 +698,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
|
||||
def _stop_reflector(self):
|
||||
if self.run_reflector_server:
|
||||
log.info("Stopping reflector server")
|
||||
try:
|
||||
if self.reflector_server_port is not None:
|
||||
self.reflector_server_port, p = None, self.reflector_server_port
|
||||
|
|
|
@ -70,6 +70,7 @@ class Publisher(object):
|
|||
return d
|
||||
|
||||
def start_reflector(self):
|
||||
log.info("Start reflector client")
|
||||
factory = reflector.ClientFactory(
|
||||
self.session.blob_manager,
|
||||
self.lbry_file_manager.stream_info_manager,
|
||||
|
|
|
@ -118,10 +118,12 @@ class LBRYFileReflectorClient(Protocol):
|
|||
reactor.callLater(0, self.producer.resumeProducing)
|
||||
|
||||
def get_blobs_to_send(self, stream_info_manager, stream_hash):
|
||||
log.info("Get blobs to send to reflector")
|
||||
d = stream_info_manager.get_blobs_for_stream(stream_hash)
|
||||
|
||||
def set_blobs(blob_hashes):
|
||||
for blob_hash, position, iv, length in blob_hashes:
|
||||
log.info("Preparing to send %s", blob_hash)
|
||||
if blob_hash is not None:
|
||||
self.blob_hashes_to_send.append(blob_hash)
|
||||
|
||||
|
@ -202,6 +204,7 @@ class LBRYFileReflectorClient(Protocol):
|
|||
raise ValueError("Couldn't open that blob for some reason. blob_hash: {}".format(blob.blob_hash))
|
||||
|
||||
def send_blob_info(self):
|
||||
log.info("Send blob info for %s", self.next_blob_to_send.blob_hash)
|
||||
assert self.next_blob_to_send is not None, "need to have a next blob to send at this point"
|
||||
self.write(json.dumps({
|
||||
'blob_hash': self.next_blob_to_send.blob_hash,
|
||||
|
|
Loading…
Reference in a new issue