In tun mode, do a delay check and restart the core

pull/4444/head
2dust 2023-11-22 16:37:46 +08:00
parent 2a37a6a28e
commit e7b2deb941
1 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using System.Diagnostics;
using System.IO;
using System.Reactive.Linq;
using System.Text;
using v2rayN.Mode;
using v2rayN.Resx;
@ -45,6 +46,25 @@ namespace v2rayN.Handler
ShowMsg(true, $"{node.GetSummary()}");
CoreStop();
CoreStart(node);
//In tun mode, do a delay check and restart the core
if (_config.tunModeItem.enableTun)
{
Observable.Range(1, 1)
.Delay(TimeSpan.FromSeconds(15))
.Subscribe(x =>
{
{
if (_process == null || _process.HasExited)
{
CoreStart(node);
ShowMsg(false, "Tun mode restart the core once");
Utils.SaveLog("Tun mode restart the core once");
}
}
});
}
}
}