mirror of https://github.com/grpc/grpc-java.git
netty: Removed 4096 min buffer size (#11856)
* netty: Removed 4096 min buffer size
This commit is contained in:
parent
b3db8c2489
commit
7153ff8522
|
@ -33,9 +33,6 @@ import io.netty.buffer.ByteBufAllocator;
|
|||
*/
|
||||
class NettyWritableBufferAllocator implements WritableBufferAllocator {
|
||||
|
||||
// Use 4k as our minimum buffer size.
|
||||
private static final int MIN_BUFFER = 4 * 1024;
|
||||
|
||||
// Set the maximum buffer size to 1MB.
|
||||
private static final int MAX_BUFFER = 1024 * 1024;
|
||||
|
||||
|
@ -47,7 +44,7 @@ class NettyWritableBufferAllocator implements WritableBufferAllocator {
|
|||
|
||||
@Override
|
||||
public WritableBuffer allocate(int capacityHint) {
|
||||
capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint));
|
||||
capacityHint = Math.min(MAX_BUFFER, capacityHint);
|
||||
return new NettyWritableBuffer(allocator.buffer(capacityHint, capacityHint));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,6 @@ public class NettyWritableBufferAllocatorTest extends WritableBufferAllocatorTes
|
|||
return allocator;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCapacityHasMinimum() {
|
||||
WritableBuffer buffer = allocator().allocate(100);
|
||||
assertEquals(0, buffer.readableBytes());
|
||||
assertEquals(4096, buffer.writableBytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCapacityIsExactAboveMinimum() {
|
||||
WritableBuffer buffer = allocator().allocate(9000);
|
||||
|
|
Loading…
Reference in New Issue