尝试修复退出错误

修复停止时进程堵塞
This commit is contained in:
ChsBuffer
2020-07-25 04:02:01 +08:00
parent 6174e78696
commit bbf9c5ed7c
11 changed files with 160 additions and 151 deletions

View File

@@ -146,9 +146,14 @@ namespace Netch.Controllers
/// </summary>
public void Stop()
{
Task.Run(() => pEncryptedProxyController?.Stop());
Task.Run(() => UsingPorts.Clear());
pModeController?.Stop();
var tasks = new[]
{
Task.Factory.StartNew(() => pEncryptedProxyController?.Stop()),
Task.Factory.StartNew(() => UsingPorts.Clear()),
Task.Factory.StartNew(() => pModeController?.Stop()),
Task.Factory.StartNew(() => pNTTController.Stop())
};
Task.WaitAll(tasks);
}
public static void KillProcessByName(string name)