Commit 55562cc6 authored by rgaudin's avatar rgaudin
Browse files

Fixed internet connectivity detection

testing internet connectivity through connection test to 1.1.1.1:53
instead of www.google.com:80

In case internet is actually not present, previous test would fail (indicating connectio OK)
after receiving captive portal response from HTTP due to DNSmasq.

New test would not be spoofed and is thus more reliable
parent 0c7d851f
Pipeline #200790 passed with stage
in 303 minutes and 59 seconds
......@@ -4,9 +4,9 @@
import socket
def is_connected(hostname="www.google.com"):
def is_connected(host="1.1.1.1"):
try:
socket.create_connection((socket.gethostbyname(hostname), 80), timeout=2)
socket.create_connection((host, 53), timeout=4)
return True
except Exception:
pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment