Indentation done

Signed-off-by: Aarush289 <cs24b064@smail.iitm.ac.in>
This commit is contained in:
Aarush289 2025-10-25 13:38:21 +05:30 committed by GitHub
parent a83c17f21e
commit d85260924a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 6 deletions

View File

@ -52,15 +52,18 @@ def _system_search_suffixes() -> list[str]:
with open("/etc/resolv.conf") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"): continue
if not line or line.startswith("#"):
continue
if line.startswith("search") or line.startswith("domain"):
sufs += [x for x in line.split()[1:] if x]
except Exception:
pass
seen = set(); out: list[str] = []
seen = set()
out: list[str] = []
for s in sufs:
if s not in seen:
seen.add(s); out.append(s)
seen.add(s)
out.append(s)
return out
# --- safer, more robust pieces to replace in hostcheck.py ---
@ -115,7 +118,7 @@ def resolve_quick(
if not candidates:
return False, None
for pass_ix, (use_ai_addrconfig, port) in enumerate(((True, None), (False, None))):
for _pass_ix, (use_ai_addrconfig, port) in enumerate(((True, None), (False, None))):
deadline = time.monotonic() + timeout_sec
maxw = min(len(candidates), 4)
ex = concurrent.futures.ThreadPoolExecutor(max_workers=maxw)
@ -145,7 +148,8 @@ def resolve_quick(
ex.shutdown(wait=False)
canon = chosen[:-1] if chosen.endswith(".") else chosen
return True, canon.lower()
except Exception:
except (OSError, socket.gaierror):
# DNS resolution failed for this candidate, try next
continue
# cancel any survivors in this pass
for f in fut2cand: