fix: preserve queued disconnect reason

This commit is contained in:
Anon 2026-07-27 00:35:18 +02:00
parent 6e4bca5073
commit eea631f69e

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();