commit 41f160dd74dc60434acac882393374cb15a381f0
parent eaf203dbb566a555253e22dbd42affefad218869
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 27 May 2019 19:35:30 +0200
update to aiorpcx 0.18
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/contrib/requirements/requirements.txt b/contrib/requirements/requirements.txt
@@ -5,7 +5,7 @@ protobuf
dnspython
jsonrpclib-pelix
qdarkstyle<3.0
-aiorpcx>=0.17,<0.18
+aiorpcx>=0.18,<0.19
aiohttp>=3.3.0
aiohttp_socks
certifi
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -39,6 +39,7 @@ import aiorpcx
from aiorpcx import RPCSession, Notification, NetAddress
from aiorpcx.curio import timeout_after, TaskTimeout
from aiorpcx.jsonrpc import JSONRPC
+from aiorpcx.rawsocket import RSClient
import certifi
from .util import ignore_exceptions, log_exceptions, bfh, SilentTaskGroup
@@ -172,7 +173,7 @@ class ErrorGettingSSLCertFromServer(Exception): pass
class ConnectError(Exception): pass
-class _Connector(aiorpcx.Connector):
+class _RSClient(RSClient):
async def create_connection(self):
try:
return await super().create_connection()
@@ -392,9 +393,9 @@ class Interface(Logger):
async def get_certificate(self):
sslc = ssl.SSLContext()
try:
- async with _Connector(RPCSession,
- host=self.host, port=self.port,
- ssl=sslc, proxy=self.proxy) as session:
+ async with _RSClient(session_factory=RPCSession,
+ host=self.host, port=self.port,
+ ssl=sslc, proxy=self.proxy) as session:
return session.transport._ssl_protocol._sslpipe._sslobj.getpeercert(True)
except ValueError:
return None
@@ -430,9 +431,9 @@ class Interface(Logger):
return self.network.default_server == self.server
async def open_session(self, sslc, exit_early=False):
- async with _Connector(NotificationSession,
- host=self.host, port=self.port,
- ssl=sslc, proxy=self.proxy) as session:
+ async with _RSClient(session_factory=NotificationSession,
+ host=self.host, port=self.port,
+ ssl=sslc, proxy=self.proxy) as session:
self.session = session # type: NotificationSession
self.session.interface = self
self.session.set_default_timeout(self.network.get_network_timeout_seconds(NetworkTimeout.Generic))