bug: fix a bug where not all errors could be handled when scanning.

This commit is contained in:
UpstreamData
2023-02-16 12:22:58 -07:00
parent 3394234e4f
commit 1f1e5f23a2

View File

@@ -183,14 +183,14 @@ class MinerNetwork:
miner = await ping_and_get_miner(ip)
if miner:
return miner
except ConnectionRefusedError:
except (ConnectionRefusedError, OSError):
tasks = [ping_and_get_miner(ip, port=port) for port in [4029, 8889]]
for miner in asyncio.as_completed(tasks):
try:
miner = await miner
if miner:
return miner
except ConnectionRefusedError:
except (ConnectionRefusedError, OSError):
pass
@@ -250,6 +250,5 @@ async def ping_and_get_miner(
# ping failed, likely with an exception
except Exception as e:
logging.warning(f"{str(ip)}: Ping And Get Miner Exception: {e}")
raise e
continue
raise ConnectionRefusedError
return