From 84ea2eb3866a17549a9d0943e8f1ec8aa95ac644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Thu, 16 Jan 2025 09:50:16 +0100 Subject: [PATCH] Clean up accumulate --- .../src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt index 7be46431a38f..87499f08e15a 100644 --- a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt +++ b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/TalpidVpnService.kt @@ -7,7 +7,7 @@ import androidx.annotation.CallSuper import androidx.core.content.getSystemService import androidx.lifecycle.lifecycleScope import arrow.core.Either -import arrow.core.flattenOrAccumulate +import arrow.core.mapOrAccumulate import arrow.core.merge import arrow.core.raise.either import arrow.core.raise.ensureNotNull @@ -113,8 +113,8 @@ open class TalpidVpnService : LifecycleVpnService() { // then notify daemon to later enter blocked state. val dnsConfigureResult = config.dnsServers - .map { builder.addDnsServerE(it) } - .flattenOrAccumulate() + .mapOrAccumulate { builder.addDnsServerE(it).bind() } + .map { /* Ignore right */ } .onLeft { // Avoid creating a tunnel with no DNS servers or if all DNS servers was // invalid, since apps then may leak DNS requests. @@ -127,7 +127,6 @@ open class TalpidVpnService : LifecycleVpnService() { builder.addDnsServer(FALLBACK_DUMMY_DNS_SERVER) } } - .map { /* Ignore right */ } val vpnInterfaceFd = builder