433692 improved buffer resizing
This commit is contained in:
parent
f65e40f8e7
commit
1c97fd3c42
|
@ -103,10 +103,10 @@ public abstract class BufferingResponseListener extends Listener.Adapter
|
|||
int length = content.remaining();
|
||||
if (length>BufferUtil.space(buffer))
|
||||
{
|
||||
int requiredCapacity = buffer.capacity()+length;
|
||||
int requiredCapacity = buffer==null?0:buffer.capacity()+length;
|
||||
if (requiredCapacity>maxLength)
|
||||
response.abort(new IllegalArgumentException("Buffering capacity exceeded"));
|
||||
|
||||
|
||||
int newCapacity = Math.min(Integer.highestOneBit(requiredCapacity) << 1, maxLength);
|
||||
buffer = BufferUtil.ensureCapacity(buffer,newCapacity);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue