mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-30 00:41:25 +00:00
Something at least
This commit is contained in:
parent
e6240b14ee
commit
c703f8bbe6
2 changed files with 20 additions and 4 deletions
|
@ -225,6 +225,9 @@ def ensure_directory_exists(path: str):
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
asyncio.set_event_loop(asyncio.ProactorEventLoop())
|
||||||
|
|
||||||
argv = argv or sys.argv[1:]
|
argv = argv or sys.argv[1:]
|
||||||
parser = get_argument_parser()
|
parser = get_argument_parser()
|
||||||
args, command_args = parser.parse_known_args(argv)
|
args, command_args = parser.parse_known_args(argv)
|
||||||
|
@ -310,7 +313,4 @@ def main(argv=None):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if sys.platform == 'win32':
|
|
||||||
asyncio.set_event_loop(asyncio.ProactorEventLoop())
|
|
||||||
|
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
|
@ -407,6 +407,16 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
await self.update_connection_status()
|
await self.update_connection_status()
|
||||||
return CONNECTION_STATUS_CONNECTED if self._connection_status[1] else CONNECTION_STATUS_NETWORK
|
return CONNECTION_STATUS_CONNECTED if self._connection_status[1] else CONNECTION_STATUS_NETWORK
|
||||||
|
|
||||||
|
# async def start_named_pipes(self):
|
||||||
|
# asyncio.set_event_loop(asyncio.ProactorEventLoop())
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# site = web.NamedPipeSite(self.runner, PIPE_NAME)
|
||||||
|
# await site.start()
|
||||||
|
# log.info('lbrynet API listening on pipe %s', site.name)
|
||||||
|
# except Exception as e:
|
||||||
|
# log.error(str(e))
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
log.info("Starting LBRYNet Daemon")
|
log.info("Starting LBRYNet Daemon")
|
||||||
log.debug("Settings: %s", json.dumps(self.conf.settings_dict, indent=2))
|
log.debug("Settings: %s", json.dumps(self.conf.settings_dict, indent=2))
|
||||||
|
@ -415,13 +425,19 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
await self.runner.setup()
|
await self.runner.setup()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
print(asyncio.get_event_loop())
|
||||||
site = web.NamedPipeSite(self.runner, PIPE_NAME)
|
site = web.NamedPipeSite(self.runner, PIPE_NAME)
|
||||||
await site.start()
|
await site.start()
|
||||||
# loop = asyncio.get_event_loop()
|
# loop = asyncio.get_event_loop()
|
||||||
# await loop.start_serving_pipe(lambda : NamedPipeServer(self.handle_pipe_request), PIPE_NAME)
|
# await loop.start_serving_pipe(lambda : NamedPipeServer(self.handle_pipe_request), PIPE_NAME)
|
||||||
log.info('lbrynet API listening on pipe %s', site.name)
|
log.info('lbrynet API listening on pipe %s', site.name)
|
||||||
except Exception as e:
|
except (PermissionError, RuntimeError) as e:
|
||||||
|
log.error('lbrynet API failed to open Named Pipe %s for listening. Daemon is already running '
|
||||||
|
'or this Named Pipe is being used by another application.', PIPE_NAME)
|
||||||
log.error(str(e))
|
log.error(str(e))
|
||||||
|
# await self.analytics_manager.send_server_startup_error(str(e))
|
||||||
|
raise SystemExit()
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
site = web.TCPSite(self.runner, self.conf.api_host, self.conf.api_port)
|
site = web.TCPSite(self.runner, self.conf.api_host, self.conf.api_port)
|
||||||
|
|
Loading…
Add table
Reference in a new issue