Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Set max capacity for remaining buf
This allows the returned buffer to be a cached empty buf if the original buffer was already fully read
Dieser Commit ist enthalten in:
Ursprung
d3f92ce9b8
Commit
2f08f0d58c
@ -373,7 +373,7 @@ public class UserConnectionImpl implements UserConnection {
|
||||
|
||||
// Instead of allocating a possible unnecessarily large buffer to write the wrapper contents to,
|
||||
// only allocate the remaining bytes and write the rest to the original buf's head directly.
|
||||
final ByteBuf remainingBuf = buf.alloc().buffer(remainingBytes);
|
||||
final ByteBuf remainingBuf = buf.alloc().buffer(remainingBytes, remainingBytes);
|
||||
try {
|
||||
// Copy before modifying the buffer
|
||||
remainingBuf.writeBytes(buf, remainingBytes);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren