mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-29 13:04:59 +00:00
Add cookie snapshotting during connection transfer
Snapshot cookies before disposing of the old handler and restore them for the new connection.
This commit is contained in:
parent
6a5b28b0bd
commit
9b96873d87
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue