improve VPN clean-up code
This commit is contained in:
parent
a2662c325d
commit
1e5651eec3
|
@ -137,14 +137,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
mProxyServer = null;
|
mProxyServer = null;
|
||||||
}
|
}
|
||||||
if (mInterface != null){
|
if (mInterface != null){
|
||||||
try {
|
onRevoke();
|
||||||
Log.d(TAG,"closing interface, destroying VPN interface");
|
|
||||||
mInterface.close();
|
|
||||||
mInterface = null;
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,8 +215,15 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
Log.d(TAG,"closing interface, destroying VPN interface");
|
||||||
|
|
||||||
|
if (mInterface != null)
|
||||||
{
|
{
|
||||||
mInterface.close();
|
mInterface.close();
|
||||||
|
mInterface = null;
|
||||||
|
}
|
||||||
|
|
||||||
Tun2Socks.Stop();
|
Tun2Socks.Stop();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Reference in New Issue