mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-13 05:07:23 +08:00
fix vpn close when getting new subnet route (#179)
This commit is contained in:
@@ -57,21 +57,23 @@ class TauriVpnService : VpnService() {
|
||||
|
||||
override fun onDestroy() {
|
||||
println("vpn on destroy")
|
||||
self = null
|
||||
super.onDestroy()
|
||||
disconnect()
|
||||
self = null
|
||||
}
|
||||
|
||||
override fun onRevoke() {
|
||||
println("vpn on revoke")
|
||||
self = null
|
||||
super.onRevoke()
|
||||
disconnect()
|
||||
self = null
|
||||
}
|
||||
|
||||
private fun disconnect() {
|
||||
triggerCallback("vpn_service_stop", JSObject())
|
||||
vpnInterface.close()
|
||||
if (self == this && this::vpnInterface.isInitialized) {
|
||||
triggerCallback("vpn_service_stop", JSObject())
|
||||
vpnInterface.close()
|
||||
}
|
||||
}
|
||||
|
||||
private fun createVpnInterface(args: Bundle?): ParcelFileDescriptor {
|
||||
|
||||
Reference in New Issue
Block a user