Commit 44f37d14 authored by Mygod's avatar Mygod

Suppress DnsExceptions

parent 483f1609
......@@ -20,6 +20,8 @@
package com.github.shadowsocks.net
import android.net.DnsResolver
import android.os.Build
import android.util.Log
import com.crashlytics.android.Crashlytics
import com.github.shadowsocks.utils.printLog
......@@ -142,8 +144,9 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd
when (e) {
is TimeoutCancellationException -> Crashlytics.log(Log.WARN, TAG, "Remote resolving timed out")
is CancellationException -> { } // ignore
is IOException -> Crashlytics.log(Log.WARN, TAG, e.message)
else -> printLog(e)
else -> if (e is IOException || Build.VERSION.SDK_INT >= 29 && e is DnsResolver.DnsException) {
Crashlytics.log(Log.WARN, TAG, e.message)
} else printLog(e)
}
ByteBuffer.wrap(prepareDnsResponse(request).apply {
header.rcode = Rcode.SERVFAIL
......
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