summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/service/CustomDns.kt26
1 files changed, 6 insertions, 20 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/CustomDns.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/CustomDns.kt
index f52fd63862..aec190d81d 100644
--- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/CustomDns.kt
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/CustomDns.kt
@@ -38,19 +38,21 @@ class CustomDns(private val endpoint: ServiceEndpoint) {
endpoint.dispatcher.apply {
registerHandler(Request.AddCustomDnsServer::class) { request ->
- addDnsServer(request.address)
+ commandChannel.sendBlocking(Command.AddDnsServer(request.address))
}
registerHandler(Request.RemoveCustomDnsServer::class) { request ->
- removeDnsServer(request.address)
+ commandChannel.sendBlocking(Command.RemoveDnsServer(request.address))
}
registerHandler(Request.ReplaceCustomDnsServer::class) { request ->
- replaceDnsServer(request.oldAddress, request.newAddress)
+ commandChannel.sendBlocking(
+ Command.ReplaceDnsServer(request.oldAddress, request.newAddress)
+ )
}
registerHandler(Request.SetEnableCustomDns::class) { request ->
- setEnabled(request.enable)
+ commandChannel.sendBlocking(Command.SetEnabled(request.enable))
}
}
}
@@ -60,22 +62,6 @@ class CustomDns(private val endpoint: ServiceEndpoint) {
commandChannel.close()
}
- fun addDnsServer(server: InetAddress) {
- commandChannel.sendBlocking(Command.AddDnsServer(server))
- }
-
- fun replaceDnsServer(oldServer: InetAddress, newServer: InetAddress) {
- commandChannel.sendBlocking(Command.ReplaceDnsServer(oldServer, newServer))
- }
-
- fun removeDnsServer(server: InetAddress) {
- commandChannel.sendBlocking(Command.RemoveDnsServer(server))
- }
-
- fun setEnabled(enabled: Boolean) {
- commandChannel.sendBlocking(Command.SetEnabled(enabled))
- }
-
private fun spawnActor() = GlobalScope.actor<Command>(Dispatchers.Default, Channel.UNLIMITED) {
try {
while (true) {