Ensure flowController().writePendingBytes() is triggered when writing response in example

Motivation:

We called ctx.flush() which is not correct as it will not call flowController().writePendingBytes().

Modifications:

Call flush(ChannelHandlerContext) and so also call flowController().writePendingBytes().

Result:

Correct http2 example
This commit is contained in:
Norman Maurer 2016-09-12 16:10:08 -07:00
parent e3fbfe5641
commit e94db103c9

View File

@ -78,7 +78,11 @@ public final class HelloWorldHttp2Handler extends Http2ConnectionHandler impleme
Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText());
encoder().writeHeaders(ctx, streamId, headers, 0, false, ctx.newPromise());
encoder().writeData(ctx, streamId, payload, 0, true, ctx.newPromise());
ctx.flush();
try {
flush(ctx);
} catch (Throwable cause) {
onError(ctx, cause);
}
}
@Override