mirror of
https://github.com/YunoHost/check-http.git
synced 2024-09-03 19:56:42 +02:00
fix: handle OSError exception on asyncio sockets
This commit is contained in:
parent
d3abbf0f1e
commit
9ef4dd6d35
1 changed files with 2 additions and 2 deletions
|
@ -295,7 +295,7 @@ async def check_port_is_open(ip, port):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_, writer = await asyncio.wait_for(futur, timeout=2)
|
_, writer = await asyncio.wait_for(futur, timeout=2)
|
||||||
except (asyncio.TimeoutError, ConnectionRefusedError):
|
except (asyncio.TimeoutError, ConnectionRefusedError, OSError): # OSError: [Errno 113] No route to host
|
||||||
return False
|
return False
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -350,7 +350,7 @@ async def check_smtp(request):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reader, writer = await asyncio.wait_for(futur, timeout=2)
|
reader, writer = await asyncio.wait_for(futur, timeout=2)
|
||||||
except (asyncio.TimeoutError, ConnectionRefusedError):
|
except (asyncio.TimeoutError, ConnectionRefusedError, OSError): # OSError: [Errno 113] No route to host
|
||||||
return json_response({
|
return json_response({
|
||||||
'status': "error_smtp_unreachable",
|
'status': "error_smtp_unreachable",
|
||||||
'content': "Could not open a connection on port 25, probably because of a firewall or port forwarding issue"
|
'content': "Could not open a connection on port 25, probably because of a firewall or port forwarding issue"
|
||||||
|
|
Loading…
Reference in a new issue