From bf697dafb1a4079f54421476bd34921681ca1605 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 2 Feb 2019 00:28:06 +0800 Subject: [PATCH] Suppress loud disabling error --- .../main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt index 2d2875e3..39475629 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/DhcpWorkaround.kt @@ -28,8 +28,12 @@ object DhcpWorkaround : SharedPreferences.OnSharedPreferenceChangeListener { try { RootSession.use { it.exec("ip rule $action iif lo uidrange 0-0 lookup local_network priority 11000") } } catch (e: RootSession.UnexpectedOutputException) { - if (e.result.code == 2 && e.result.out.isEmpty() && - e.result.err.joinToString("\n") == "RTNETLINK answers: File exists") return + if (e.result.out.isEmpty() && if (enabled) { + e.result.code == 2 && e.result.err.joinToString("\n") == "RTNETLINK answers: File exists" + } else { + e.result.code == 254 && + e.result.err.joinToString("\n") == "RTNETLINK answers: No such file or directory" + }) return Timber.w(e) SmartSnackbar.make(e).show() } catch (e: Exception) {