fix: Fixes libdeflate threading issue (#1813)

This commit is contained in:
Kamron Batman 2024-06-02 15:02:47 -07:00 committed by GitHub
parent aeba2261d2
commit a8d3d2773e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 11 deletions

View file

@ -20,16 +20,8 @@ namespace Server.Compression;
public static class Deflate
{
public static LibDeflateBinding Standard { get; }
[ThreadStatic]
private static LibDeflateBinding _standard;
static Deflate()
{
Standard = new LibDeflateBinding();
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
Standard.Dispose();
}
public static LibDeflateBinding Standard => _standard ??= new LibDeflateBinding();
}