From 8cbdab9d83e9fc0db45b97e60743b51651fe0988 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 28 May 2022 19:41:43 +0000 Subject: [PATCH] support aiohttp, add localhost resolution workaround - this may speed up RPC performance for all backends on some Windows systems --- mmgen/globalvars.py | 1 - mmgen/rpc.py | 4 ++++ setup.cfg | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mmgen/globalvars.py b/mmgen/globalvars.py index c2195a13..7e5d27a0 100755 --- a/mmgen/globalvars.py +++ b/mmgen/globalvars.py @@ -281,7 +281,6 @@ class GlobalContext(Lockable): 'rpc_backend': ov('nocase_pfx', ['auto','httplib','curl','aiohttp','requests']), } if platform == 'win': - autoset_opts['rpc_backend'].choices.remove('aiohttp') _skip_type_check = ('stdout','stderr') auto_typeset_opts = { diff --git a/mmgen/rpc.py b/mmgen/rpc.py index a995c405..ebd66338 100755 --- a/mmgen/rpc.py +++ b/mmgen/rpc.py @@ -267,6 +267,10 @@ class RPCClient(MMGenObject): def __init__(self,host,port,test_connection=True): + # aiohttp workaround, and may speed up RPC performance overall on some systems: + if g.platform == 'win' and host == 'localhost': + host = '127.0.0.1' + dmsg_rpc(f'=== {type(self).__name__}.__init__() debug ===') dmsg_rpc(f' cls [{type(self).__name__}] host [{host}] port [{port}]\n') diff --git a/setup.cfg b/setup.cfg index c4c93400..cf02c675 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,12 +31,12 @@ install_requires = cryptography pynacl ecdsa + aiohttp requests pysocks # xmrwallet.py pexpect scrypt; platform_system != "Windows" # must be installed by hand on MSYS2 semantic-version; platform_system != "Windows" # scripts/create-token.py - aiohttp; platform_system != "Windows" pysha3; platform_system != "Windows" packages =