mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-30 08:51:27 +00:00
Using NamedPipeSite(aiohttp, not committed)
This commit is contained in:
parent
0b032c5346
commit
e6240b14ee
2 changed files with 8 additions and 4 deletions
|
@ -25,7 +25,8 @@ def display(data):
|
||||||
|
|
||||||
|
|
||||||
async def execute_command(conf, method, params):
|
async def execute_command(conf, method, params):
|
||||||
async with aiohttp.ClientSession() as session:
|
conn = aiohttp.NamedPipeConnector(path=r'\\.\pipe\lbrypipe')
|
||||||
|
async with aiohttp.ClientSession(connector=conn) as session:
|
||||||
try:
|
try:
|
||||||
message = {'method': method, 'params': params}
|
message = {'method': method, 'params': params}
|
||||||
async with session.get(conf.api_connection_url, json=message) as resp:
|
async with session.get(conf.api_connection_url, json=message) as resp:
|
||||||
|
|
|
@ -286,6 +286,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
logging.getLogger('aiohttp.access').setLevel(logging.WARN)
|
logging.getLogger('aiohttp.access').setLevel(logging.WARN)
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_get('/lbryapi', self.handle_old_jsonrpc)
|
app.router.add_get('/lbryapi', self.handle_old_jsonrpc)
|
||||||
|
app.router.add_get('/', self.handle_old_jsonrpc)
|
||||||
app.router.add_post('/lbryapi', self.handle_old_jsonrpc)
|
app.router.add_post('/lbryapi', self.handle_old_jsonrpc)
|
||||||
app.router.add_post('/', self.handle_old_jsonrpc)
|
app.router.add_post('/', self.handle_old_jsonrpc)
|
||||||
self.runner = web.AppRunner(app)
|
self.runner = web.AppRunner(app)
|
||||||
|
@ -414,9 +415,11 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
await self.runner.setup()
|
await self.runner.setup()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_event_loop()
|
site = web.NamedPipeSite(self.runner, PIPE_NAME)
|
||||||
await loop.start_serving_pipe(lambda : NamedPipeServer(self.handle_pipe_request), PIPE_NAME)
|
await site.start()
|
||||||
log.info('lbrynet API listening on pipe %s', PIPE_NAME)
|
# loop = asyncio.get_event_loop()
|
||||||
|
# await loop.start_serving_pipe(lambda : NamedPipeServer(self.handle_pipe_request), PIPE_NAME)
|
||||||
|
log.info('lbrynet API listening on pipe %s', site.name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(str(e))
|
log.error(str(e))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue