Browse Source

support aiohttp, add localhost resolution workaround

- this may speed up RPC performance for all backends on some Windows systems
The MMGen Project 2 years ago
parent
commit
8cbdab9d83
3 changed files with 5 additions and 2 deletions
  1. 0 1
      mmgen/globalvars.py
  2. 4 0
      mmgen/rpc.py
  3. 1 1
      setup.cfg

+ 0 - 1
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 = {

+ 4 - 0
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')
 

+ 1 - 1
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 =