Unverified Commit 9711da1c authored by Mygod's avatar Mygod Committed by GitHub

Clean up unused code

parent 5e751564
...@@ -26,9 +26,7 @@ import android.net.DnsResolver ...@@ -26,9 +26,7 @@ import android.net.DnsResolver
import android.net.Network import android.net.Network
import android.os.Build import android.os.Build
import android.os.CancellationSignal import android.os.CancellationSignal
import android.os.Looper
import android.system.ErrnoException import android.system.ErrnoException
import android.system.Os
import com.github.shadowsocks.Core import com.github.shadowsocks.Core
import com.github.shadowsocks.utils.int import com.github.shadowsocks.utils.int
import kotlinx.coroutines.* import kotlinx.coroutines.*
...@@ -78,8 +76,6 @@ sealed class DnsResolverCompat { ...@@ -78,8 +76,6 @@ sealed class DnsResolverCompat {
@Throws(IOException::class) @Throws(IOException::class)
abstract fun bindSocket(network: Network, socket: FileDescriptor) abstract fun bindSocket(network: Network, socket: FileDescriptor)
internal open suspend fun connectUdp(fd: FileDescriptor, address: InetAddress, port: Int = 0) =
Os.connect(fd, address, port)
abstract suspend fun resolve(network: Network, host: String): Array<InetAddress> abstract suspend fun resolve(network: Network, host: String): Array<InetAddress>
abstract suspend fun resolveOnActiveNetwork(host: String): Array<InetAddress> abstract suspend fun resolveOnActiveNetwork(host: String): Array<InetAddress>
abstract suspend fun resolveRaw(network: Network, query: ByteArray): ByteArray abstract suspend fun resolveRaw(network: Network, query: ByteArray): ByteArray
...@@ -100,12 +96,6 @@ sealed class DnsResolverCompat { ...@@ -100,12 +96,6 @@ sealed class DnsResolverCompat {
throw IOException(message, ErrnoException(message, -err)) throw IOException(message, ErrnoException(message, -err))
} }
override suspend fun connectUdp(fd: FileDescriptor, address: InetAddress, port: Int) {
if (Looper.getMainLooper().thread == Thread.currentThread()) withContext(Dispatchers.IO) { // #2405
super.connectUdp(fd, address, port)
} else super.connectUdp(fd, address, port)
}
/** /**
* This dispatcher is used for noncancellable possibly-forever-blocking operations in network IO. * This dispatcher is used for noncancellable possibly-forever-blocking operations in network IO.
* *
......
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