HTTP2: Update local flow-controller on Channel.read() if needed (#9400)

Motivation:

We should better update the flow-controller on Channel.read() to reduce overhead and memory overhead.

See https://github.com/netty/netty/pull/9390#issuecomment-513008269

Modifications:

Move updateLocalWindowIfNeeded() to doBeginRead()

Result:

Reduce memory overhead
This commit is contained in:
Norman Maurer 2019-08-16 09:27:47 +02:00
parent f673ba36a0
commit 7a375a492c

View File

@ -751,6 +751,8 @@ abstract class AbstractHttp2StreamChannel extends DefaultAttributeMap implements
if (!isActive()) { if (!isActive()) {
return; return;
} }
updateLocalWindowIfNeeded();
switch (readStatus) { switch (readStatus) {
case IDLE: case IDLE:
readStatus = ReadStatus.IN_PROGRESS; readStatus = ReadStatus.IN_PROGRESS;
@ -827,8 +829,6 @@ abstract class AbstractHttp2StreamChannel extends DefaultAttributeMap implements
readStatus = ReadStatus.IDLE; readStatus = ReadStatus.IDLE;
} }
updateLocalWindowIfNeeded();
allocHandle.readComplete(); allocHandle.readComplete();
pipeline().fireChannelReadComplete(); pipeline().fireChannelReadComplete();
if (config().isAutoRead()) { if (config().isAutoRead()) {