Try to remove the tun device when restarting the service in Windows

https://github.com/2dust/v2rayN/pull/6561
This commit is contained in:
2dust
2025-01-30 10:46:04 +08:00
parent c0f8b6b84c
commit 6c5011ad68
3 changed files with 38 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Text;
namespace ServiceLib.Handler
@@ -83,7 +83,14 @@ namespace ServiceLib.Handler
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
await CoreStop();
await Task.Delay(100);
await CoreStart(node);
if (Utils.IsWindows() && _config.TunModeItem.EnableTun)
{
await Task.Delay(100);
await WindowsUtils.RemoveTunDevice();
}
await CoreStart(node);
await CoreStartPreService(node);
if (_process != null)
{
@@ -368,4 +375,4 @@ namespace ServiceLib.Handler
#endregion Linux
}
}
}