From e2c29594f237e9f5435f54255553f72973452abc Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 22 Jan 2018 19:03:53 -0800 Subject: [PATCH] Set different timeouts --- .../java/com/github/shadowsocks/bg/LocalDnsService.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt b/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt index b67ce8b5..195b32e5 100644 --- a/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt +++ b/mobile/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt @@ -47,14 +47,14 @@ object LocalDnsService { val data = data val profile = data.profile!! - fun makeDns(name: String, address: String, edns: Boolean = true): JSONObject { + fun makeDns(name: String, address: String, timeout: Int, edns: Boolean = true): JSONObject { val dns = JSONObject() .put("Name", name) .put("Address", (when (address.parseNumericAddress()) { is Inet6Address -> "[$address]" else -> address }) + ":53") - .put("Timeout", 3) + .put("Timeout", timeout) .put("EDNSClientSubnet", JSONObject().put("Policy", "disable")) if (edns) dns .put("Protocol", "tcp") @@ -73,10 +73,10 @@ object LocalDnsService { .put("MinimumTTL", 120) .put("CacheSize", 4096) val remoteDns = JSONArray(profile.remoteDns.split(",") - .mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim()) }) + .mapIndexed { i, dns -> makeDns("UserDef-" + i, dns.trim(), 9) }) val localDns = JSONArray(arrayOf( - makeDns("Primary-1", "119.29.29.29", false), - makeDns("Primary-2", "114.114.114.114", false) + makeDns("Primary-1", "119.29.29.29", 3, false), + makeDns("Primary-2", "114.114.114.114", 3, false) )) when (profile.route) {