mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
update to aiorpcx 0.9 and require it
This commit is contained in:
parent
263c9265ae
commit
bcdb0c46fc
3 changed files with 15 additions and 10 deletions
|
@ -23,9 +23,10 @@ aiohttp==3.4.4 \
|
|||
--hash=sha256:f3df52362be39908f9c028a65490fae0475e4898b43a03d8aa29d1e765b45e07
|
||||
aiohttp_socks==0.2 \
|
||||
--hash=sha256:eba0a6e198d9a69d254bf956d68cec7615c2a4cadd861b8da46464bd13c5641d
|
||||
aiorpcX==0.8.2 \
|
||||
--hash=sha256:980d1d85a831688163ad087a1c1a88b6695a06e5e9914824676bab4251b2b1f2 \
|
||||
--hash=sha256:e53ff8917a87843875526be1261d80171f5ad09187917ff29dfdc003c1526a65
|
||||
aiorpcX==0.9.0 \
|
||||
--hash=sha256:4ad259076a3c94da5265505ef698d04a6d5a92d09e91d2296b5cc09d7d0f0c2c \
|
||||
--hash=sha256:71bfd014669bec0ffe2e1b82c1978b2c66330ce5adb3162529a6e066531703e7 \
|
||||
--hash=sha256:df621d8a434d4354554496c1e2db74056c88c7e9742cb3e343a22acca27dfc50
|
||||
async_timeout==3.0.1 \
|
||||
--hash=sha256:0c3c816a028d47f659d6ff5c745cb2acf1f966da1fe5c19c77a70282b25f4c5f \
|
||||
--hash=sha256:4291ca197d287d274d0b6cb5d6f8f8f82d434ed288f962539ff18cc9012f9ea3
|
||||
|
|
|
@ -6,6 +6,6 @@ protobuf
|
|||
dnspython
|
||||
jsonrpclib-pelix
|
||||
qdarkstyle<3.0
|
||||
aiorpcx>=0.8.2,<0.9
|
||||
aiorpcx>=0.9,<0.10
|
||||
aiohttp
|
||||
aiohttp_socks
|
||||
|
|
|
@ -32,7 +32,7 @@ from typing import Tuple, Union, List, TYPE_CHECKING
|
|||
from collections import defaultdict
|
||||
|
||||
import aiorpcx
|
||||
from aiorpcx import ClientSession, Notification
|
||||
from aiorpcx import RPCSession, Notification
|
||||
|
||||
from .util import PrintError, ignore_exceptions, log_exceptions, bfh, SilentTaskGroup
|
||||
from . import util
|
||||
|
@ -47,7 +47,7 @@ if TYPE_CHECKING:
|
|||
from .network import Network
|
||||
|
||||
|
||||
class NotificationSession(ClientSession):
|
||||
class NotificationSession(RPCSession):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NotificationSession, self).__init__(*args, **kwargs)
|
||||
|
@ -71,7 +71,7 @@ class NotificationSession(ClientSession):
|
|||
async def send_request(self, *args, timeout=-1, **kwargs):
|
||||
# note: the timeout starts after the request touches the wire!
|
||||
if timeout == -1:
|
||||
timeout = 20 if not self.proxy else 30
|
||||
timeout = 30
|
||||
# note: the semaphore implementation guarantees no starvation
|
||||
async with self.in_flight_requests_semaphore:
|
||||
try:
|
||||
|
@ -307,7 +307,9 @@ class Interface(PrintError):
|
|||
async def get_certificate(self):
|
||||
sslc = ssl.SSLContext()
|
||||
try:
|
||||
async with aiorpcx.ClientSession(self.host, self.port, ssl=sslc, proxy=self.proxy) as session:
|
||||
async with aiorpcx.Connector(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
|
||||
|
@ -340,8 +342,10 @@ class Interface(PrintError):
|
|||
return conn, res['count']
|
||||
|
||||
async def open_session(self, sslc, exit_early=False):
|
||||
self.session = NotificationSession(self.host, self.port, ssl=sslc, proxy=self.proxy)
|
||||
async with self.session as session:
|
||||
async with aiorpcx.Connector(NotificationSession,
|
||||
host=self.host, port=self.port,
|
||||
ssl=sslc, proxy=self.proxy) as session:
|
||||
self.session = session # type: NotificationSession
|
||||
try:
|
||||
ver = await session.send_request('server.version', [ELECTRUM_VERSION, PROTOCOL_VERSION])
|
||||
except aiorpcx.jsonrpc.RPCError as e:
|
||||
|
|
Loading…
Add table
Reference in a new issue