bug: fix a bug where not all errors could be handled when scanning.
This commit is contained in:
@@ -183,14 +183,14 @@ class MinerNetwork:
|
|||||||
miner = await ping_and_get_miner(ip)
|
miner = await ping_and_get_miner(ip)
|
||||||
if miner:
|
if miner:
|
||||||
return miner
|
return miner
|
||||||
except ConnectionRefusedError:
|
except (ConnectionRefusedError, OSError):
|
||||||
tasks = [ping_and_get_miner(ip, port=port) for port in [4029, 8889]]
|
tasks = [ping_and_get_miner(ip, port=port) for port in [4029, 8889]]
|
||||||
for miner in asyncio.as_completed(tasks):
|
for miner in asyncio.as_completed(tasks):
|
||||||
try:
|
try:
|
||||||
miner = await miner
|
miner = await miner
|
||||||
if miner:
|
if miner:
|
||||||
return miner
|
return miner
|
||||||
except ConnectionRefusedError:
|
except (ConnectionRefusedError, OSError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -250,6 +250,5 @@ async def ping_and_get_miner(
|
|||||||
# ping failed, likely with an exception
|
# ping failed, likely with an exception
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(f"{str(ip)}: Ping And Get Miner Exception: {e}")
|
logging.warning(f"{str(ip)}: Ping And Get Miner Exception: {e}")
|
||||||
raise e
|
raise ConnectionRefusedError
|
||||||
continue
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user