From 0cf95ac8a3b8863643e2bdf9f8a34ad762564632 Mon Sep 17 00:00:00 2001 From: vemneyy <78843201+vemneyy@users.noreply.github.com> Date: Sun, 2 Aug 2026 05:35:36 +0300 Subject: [PATCH] fix: tunnel dying some time after a network handover (#5994) --- .../com/v2ray/ang/core/CoreServiceManager.kt | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt index 2f50d3b1c..21319210a 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/core/CoreServiceManager.kt @@ -250,7 +250,7 @@ object CoreServiceManager { if (!isRunning()) return false return try { - val tunFd = tunFdForCore() + val tunFd = currentVpnInterface isReloading = true LogUtil.i(AppConfig.TAG, "StartCore-Manager: Core reload start...") @@ -270,23 +270,6 @@ object CoreServiceManager { } } - /** - * Returns the tun descriptor to hand to the core on a reload. - * - * With hev-socks5-tunnel the core is started without a tun and never touches the descriptor. - * Otherwise it closes the one it was given when it stops, which would take the VPN interface - * down, so it gets a duplicate to close instead. - */ - private fun tunFdForCore(): ParcelFileDescriptor? { - val vpnInterface = currentVpnInterface ?: return null - return try { - if (SettingsManager.isUsingHevTun()) vpnInterface else vpnInterface.dup() - } catch (e: Exception) { - LogUtil.e(AppConfig.TAG, "StartCore-Manager: Failed to duplicate VPN interface", e) - throw e - } - } - /** * Queries and resets all outbound traffic counters in one core call. * Go side format: tag,direction,value;tag,direction,value;