Skip to content

Commit

Permalink
🐛 Fix macOS 加速错误 等待输入密码 过长导致 IPC 异常闪退
Browse files Browse the repository at this point in the history
  • Loading branch information
Mossimos committed Sep 23, 2023
1 parent f968f3f commit 2467ce9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ public CertificateManagerImpl(IPCSubProcessService ipc)

public X509CertificatePackable RootCertificatePackable { get; set; }

readonly object lock_RootCertificatePackable = new();

byte[]? ICertificateManager.RootCertificatePackable
{
get => RootCertificate == default ? default : Serializable.SMP2(RootCertificatePackable);
get
{
lock (lock_RootCertificatePackable)
{
RootCertificate ??= LoadRootCertificate();
}
return RootCertificate == default ? default : Serializable.SMP2(RootCertificatePackable);
}
}

/// <inheritdoc cref="ICertificateManager.PfxPassword"/>
Expand Down Expand Up @@ -189,6 +198,10 @@ void SharedRemoveTrustedRootCertificate()
if (!GenerateCertificateUnlock(filePath))
return null;
}
else if (RootCertificate == null)
{
RootCertificate = LoadRootCertificate();
}
return filePath;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ await EnableProxyScripts.ContinueWith(e =>

if (!OperatingSystem.IsWindows())
{
ICertificateManager.Constants.CheckRootCertificate(
platformService,
ICertificateManager.Constants.Instance);
var checkRootCertificateCode = ICertificateManager.Constants.CheckRootCertificate(
platformService,
ICertificateManager.Constants.Instance);
if (checkRootCertificateCode != StartProxyResultCode.Ok)
{
return $"CheckRootCertificate, ErrCode: {checkRootCertificateCode}";
}
}

ReverseProxySettings reverseProxySettings = new(proxyDomains, scripts,
Expand Down

0 comments on commit 2467ce9

Please sign in to comment.