improve VPN clean-up code

This commit is contained in:
Nathan Freitas 2015-02-14 00:44:02 -05:00
parent a2662c325d
commit 1e5651eec3
1 changed files with 10 additions and 9 deletions

View File

@ -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)