🐛 fix(podkop): Handle DNS check errors and timeouts properly

This commit is contained in:
Ivan K
2025-03-30 14:46:03 +03:00
parent 732cab2ef3
commit 90d7c60fcb
2 changed files with 31 additions and 16 deletions

View File

@@ -2049,14 +2049,15 @@ check_dns_available() {
fi
fi
elif [ "$dns_type" = "dot" ]; then
nc $dns_server 853 </dev/null >/dev/null 2>&1 & pid=$!
(sleep 3; kill $pid 2>/dev/null) & killpid=$!
wait $pid >/dev/null 2>&1
if [ $? -eq 0 ]; then
(nc "$dns_server" 853 </dev/null >/dev/null 2>&1) & pid=$!
sleep 2
if kill -0 $pid 2>/dev/null; then
kill $pid 2>/dev/null
wait $pid 2>/dev/null
else
is_available=1
status="available"
fi
kill $killpid 2>/dev/null
elif [ "$dns_type" = "udp" ]; then
if nslookup -timeout=2 itdog.info $dns_server >/dev/null 2>&1; then
is_available=1