From 1e5651eec39463ef572ae4aa569ccf3b95a5cc91 Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Sat, 14 Feb 2015 00:44:02 -0500 Subject: [PATCH] improve VPN clean-up code --- .../android/vpn/OrbotVpnService.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/org/torproject/android/vpn/OrbotVpnService.java b/src/org/torproject/android/vpn/OrbotVpnService.java index 7919b077..44a27236 100644 --- a/src/org/torproject/android/vpn/OrbotVpnService.java +++ b/src/org/torproject/android/vpn/OrbotVpnService.java @@ -137,14 +137,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback { mProxyServer = null; } if (mInterface != null){ - try { - Log.d(TAG,"closing interface, destroying VPN interface"); - mInterface.close(); - mInterface = null; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + onRevoke(); + } } @@ -222,7 +216,14 @@ public class OrbotVpnService extends VpnService implements Handler.Callback { { try { - mInterface.close(); + Log.d(TAG,"closing interface, destroying VPN interface"); + + if (mInterface != null) + { + mInterface.close(); + mInterface = null; + } + Tun2Socks.Stop(); } catch (Exception e)