From 6af6b3ce158ea9ed2c2c1bce46aa27256ffdd06b Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 9 Jan 2020 22:54:48 +0800 Subject: [PATCH] Fix broken reapply rules --- mobile/src/main/java/be/mygod/vpnhotspot/RoutingManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/RoutingManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/RoutingManager.kt index 1515006a..60ca378b 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/RoutingManager.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/RoutingManager.kt @@ -57,13 +57,15 @@ abstract class RoutingManager(private val caller: Any, val downstream: String, p private var routing: Routing? = null fun start() = when (val other = active.putIfAbsentCompat(downstream, this)) { - null -> initRouting() + null -> { + if (isWifi) WifiDoubleLock.acquire(this) + initRouting() + } this -> true // already started else -> error("Double routing detected for $downstream from $caller != ${other.caller}") } private fun initRouting() = try { - if (isWifi) WifiDoubleLock.acquire(this) routing = Routing(caller, downstream).apply { try { configure()