fix: Server Cookies

将删除Cookie的时间改成断开连接的时候。
This commit is contained in:
Anon 2026-08-20 17:55:36 +02:00 committed by GitHub
commit 133c340381
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -210,6 +210,7 @@ namespace MinecraftClient
public void GetCookie(string key, out byte[]? data) => Cookies.TryGetValue(key, out data);
public void SetCookie(string key, byte[] data) => Cookies[key] = data;
public void DeleteCookie(string key) => Cookies.Remove(key, out var data);
public void DeleteAllCookies() => Cookies?.Clear();
public (Location location, string material, string typeLabel, string[] frontText, string[] backText, bool isWaxed)[] GetKnownSigns()
{
lock (signDataLock)

View file

@ -4101,6 +4101,7 @@ namespace MinecraftClient.Protocol.Handlers
finally
{
socketWrapper.Disconnect();
McClient.Instance?.DeleteAllCookies();
}
}
}
@ -6685,8 +6686,6 @@ namespace MinecraftClient.Protocol.Handlers
SendPacket(PacketTypesOut.CookieResponse, packet);
break;
}
McClient.Instance?.DeleteCookie(name);
return true;
}
catch (SocketException)