aiorpcx: pass ssl context, sleep after connecting

This commit is contained in:
Janus 2018-08-16 12:09:41 +02:00 committed by SomberNight
parent 97ea0fc439
commit 8080a713b2
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -58,9 +58,13 @@ class Interface(PrintError):
@util.aiosafe
async def run(self):
self.host, self.port, self.protocol = self.server.split(':')
async with aiorpcx.ClientSession(self.host, self.port) as session:
sslc = ssl.SSLContext(ssl.PROTOCOL_TLS) if self.protocol == 's' else None
async with aiorpcx.ClientSession(self.host, self.port, ssl=sslc) as session:
ver = await session.send_request('server.version', [ELECTRUM_VERSION, PROTOCOL_VERSION])
print(ver)
while True:
print("sleeping")
await asyncio.sleep(1)
def __init__(self, server):
self.exception = None