add variable to enable running reflector server

This commit is contained in:
Jack 2016-08-09 12:18:46 -04:00
parent 82a4fea81a
commit ef6fe3d1d9

View file

@ -170,6 +170,9 @@ 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)
@ -686,6 +689,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
return defer.succeed(True)
def _start_reflector(self):
if self.run_reflector_server:
if self.reflector_port is not None:
reflector_factory = ReflectorServerFactory(self.session.peer_manager, self.session.blob_manager)
try:
@ -697,14 +701,14 @@ class LBRYDaemon(jsonrpc.JSONRPC):
return defer.succeed(True)
def _stop_reflector(self):
if self.run_reflector_server:
try:
if self.reflector_server_port is not None:
self.reflector_server_port, p = None, self.reflector_server_port
return defer.maybeDeferred(p.stopListening)
else:
return defer.succeed(True)
except AttributeError:
return defer.succeed(True)
return defer.succeed(True)
def _stop_server(self):
try: