mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-01-02 22:07:49 +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
This commit is contained in:
parent
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);
|
||||
|
Loading…
Reference in New Issue
Block a user