From 579d08a422e88e5656a0c94f308db84e53921b19 Mon Sep 17 00:00:00 2001 From: Alter Step Date: Mon, 24 Aug 2015 00:24:16 +0200 Subject: [PATCH] It's fine if dnscrypt-proxy exit in any order (TCP first) Quit if start-dnscrypt-proxy fails. It cannot fail because there was already a running dnscrypt-proxy because if would be killed. --- .../DNSCrypt/extra/usr/scripts/start-dnscrypt-proxy.sh | 6 +++++- .../extra/usr/scripts/switch-to-dnscrypt-if-required.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/start-dnscrypt-proxy.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/start-dnscrypt-proxy.sh index 8ef0953..f4d5e23 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/start-dnscrypt-proxy.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/start-dnscrypt-proxy.sh @@ -85,9 +85,13 @@ try_resolver 5005 "${RESOLVER_NAME} using DNSCrypt over TCP" \ wait_pids="$wait_pids $!" for pid in $wait_pids; do - wait $pid + wait best_file=$(ls "$RES_DIR" | head -n 1) [ x"$best_file" != "x" ] && break + if [ ! -e "$DNSCRYPT_FILE" ]; then + logger_debug "Aborted by user" + exit 1 + fi done if [ x"$best_file" = "x" ]; then diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-to-dnscrypt-if-required.sh b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-to-dnscrypt-if-required.sh index 3dd1f80..38cfa05 100755 --- a/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-to-dnscrypt-if-required.sh +++ b/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/switch-to-dnscrypt-if-required.sh @@ -38,7 +38,7 @@ while [ -e "$DNSCRYPT_FILE" ]; do continue fi fi - ./start-dnscrypt-proxy.sh + ./start-dnscrypt-proxy.sh || continue ./check-local-dns.sh || continue ./set-dns.sh "$INTERFACE_PROXY" if [ $? != 0 ]; then