提交 b9215bd8 编写于 作者: F ff m

SteamClient vdf 修复 Linux 关闭进程通过发送 IPC 消息自行退出

上级 e609aa1e
Subproject commit 297d40f7797292a189b578399adb4cc713657780
Subproject commit 202298aaaed8a51bae21cb55fb3d740240381ef9
......@@ -29,6 +29,11 @@ sealed class LazyReverseProxyServiceImpl : IReverseProxyService
return result;
}
public void Exit()
{
impl().Exit();
}
public async Task StopProxyAsync()
{
await impl().StopProxyAsync();
......
......@@ -131,6 +131,11 @@ sealed partial class YarpReverseProxyServiceImpl : ReverseProxyServiceImpl, IRev
}
}
public void Exit()
{
Environment.Exit((int)StartProxyResultCode.BindPortError);
}
public async Task StopProxyAsync()
{
Scripts = null;
......
......@@ -47,6 +47,11 @@ public partial interface IReverseProxyService : IDisposable
/// </summary>
Task<StartProxyResult> StartProxyAsync(byte[] reverseProxySettings);
/// <summary>
/// 退出进程
/// </summary>
void Exit();
/// <summary>
/// 停止代理服务
/// </summary>
......
......@@ -198,7 +198,7 @@ partial class ProxyService
var updateHostsResult = hostsFileService.UpdateHosts(hosts);
if (updateHostsResult.ResultType != OperationResultType.Success)
{
if (OperatingSystem2.IsMacOS())
if (OperatingSystem2.IsMacOS() || OperatingSystem2.IsLinux())
{
Browser2.Open(Constants.Urls.OfficialWebsite_UnixHostAccess);
//platformService.RunShell($" \\cp \"{Path.Combine(IOPath.CacheDirectory, "hosts")}\" \"{platformService.HostsFilePath}\"");
......@@ -218,6 +218,7 @@ partial class ProxyService
if (startProxyResult.Code == StartProxyResultCode.BindPortError)
{
//新线程等待 IPC 错误返回后 Kill 自己 Linux 修改权限需要重新启动
reverseProxyService.Exit();
return "StartProxyFail: BindPortError";
}
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册