Merge pull request #3187 from MCCTeam/fix/configuration-disconnect-reason

fix: preserve queued disconnect reason
This commit is contained in:
Anon 2026-07-27 14:12:00 +02:00 committed by GitHub
commit 92212d2b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,7 +304,10 @@ namespace MinecraftClient.Protocol.Handlers
{
Stopwatch stopWatch = Stopwatch.StartNew();
long nextUpdateDue = 0;
while (!packetQueue.IsAddingCompleted)
// Continue until the reader has finished and every queued packet has been handled.
// A server can close immediately after a Disconnect packet, completing the queue
// while that final packet is still waiting to be processed.
while (!packetQueue.IsCompleted)
{
cancelToken.ThrowIfCancellationRequested();