fix: do not try to re-resize while at max packet buffer size

This commit is contained in:
mworzala 2025-01-11 18:26:11 -05:00
parent 55bcfaa07b
commit c96413678c
No known key found for this signature in database
GPG Key ID: B148F922E64797C7

View File

@ -202,6 +202,7 @@ public final class PacketWriting {
if (written < minWrite) {
// Try again with a bigger buffer
final long newSize = Math.min(buffer.capacity() * 2, ServerFlag.MAX_PACKET_SIZE);
if (newSize == buffer.capacity()) break; // We reached the maximum size
buffer.resize(newSize);
} else {
// At least one packet has been written