Skip to content

Commit

Permalink
Clean up unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod authored May 19, 2020
1 parent 5e75156 commit 9711da1
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions core/src/main/java/com/github/shadowsocks/net/DnsResolverCompat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import android.net.DnsResolver
import android.net.Network
import android.os.Build
import android.os.CancellationSignal
import android.os.Looper
import android.system.ErrnoException
import android.system.Os
import com.github.shadowsocks.Core
import com.github.shadowsocks.utils.int
import kotlinx.coroutines.*
Expand Down Expand Up @@ -78,8 +76,6 @@ sealed class DnsResolverCompat {

@Throws(IOException::class)
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 resolveOnActiveNetwork(host: String): Array<InetAddress>
abstract suspend fun resolveRaw(network: Network, query: ByteArray): ByteArray
Expand All @@ -100,12 +96,6 @@ sealed class DnsResolverCompat {
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.
*
Expand Down

0 comments on commit 9711da1

Please sign in to comment.