fix: Add cookie snapshotting for connection transfer

Add cookie snapshotting for connection transfer
This commit is contained in:
Anon 2026-08-28 00:31:37 +02:00 committed by GitHub
commit bff5ee769c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -442,6 +442,9 @@ namespace MinecraftClient
ResetStateForTransfer();
// Snapshot cookies before Dispose clears them
Dictionary<string, byte[]> savedCookies = new Dictionary<string, byte[]>(Cookies);
// Retire the old handler so its updater exits without reporting a stale disconnect.
oldHandler.Dispose();
oldClient.Close();
@ -457,6 +460,7 @@ namespace MinecraftClient
// Reinitialize the protocol handler
handler = Protocol.ProtocolHandler.GetProtocolHandler(client, protocolversion, null, this);
Cookies = savedCookies; // Restore cookies for the new connection before login
Log.Info($"Connected to {resolvedHost}:{resolvedPort}");
// Retry login process