set up cgminer get hostname, and fixed the bug with asyncio trying to close non socket objects

This commit is contained in:
UpstreamData
2021-11-09 09:54:31 -07:00
parent 201ba6829a
commit b714dfe4a4
4 changed files with 37 additions and 18 deletions

View File

@@ -3,6 +3,11 @@ from cfg_util.layout import window
from cfg_util.ui import ui
import asyncio
import sys
# Fix bug with some whatsminers and asyncio because of a socket not being shut down:
if sys.version_info[0] == 3 and sys.version_info[1] >= 8 and sys.platform.startswith('win'):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
def main():

View File

@@ -127,14 +127,6 @@ async def get_data(ip_list: list):
async def get_formatted_data(ip: ipaddress.ip_address):
# TODO: Fix bug with some whatsminers and asyncio:
# Traceback (most recent call last):
# File "C:\Users\upstr\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
# self._context.run(self._callback, *self._args)
# File "C:\Users\upstr\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
# self._sock.shutdown(socket.SHUT_RDWR)
# OSError: [WinError 10038] An operation was attempted on something that is not a socket
miner = await miner_factory.get_miner(ip)
data = await miner.api.multicommand("summary", "pools", "tunerstatus")
host = await miner.get_hostname()