DefaultHttp2ConnectionDecoder write ping buffer
Motivation: DefaultHttp2ConnectionDecoder writes a ACK when receiving a ping frame and sends the same data buffer it received. The data buffer is also passed to the listener, but the indexes are shared between the send and the listener. We should ensure the indexes are independent for these two operations. Modifications: - Call slice on the buffer that is being sent Result: Listener now has access to a buffer that will not appear to be already consumed.
This commit is contained in:
parent
92985ee747
commit
24bf36721d
@ -442,7 +442,7 @@ public class DefaultHttp2ConnectionDecoder implements Http2ConnectionDecoder {
|
||||
public void onPingRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception {
|
||||
// Send an ack back to the remote client.
|
||||
// Need to retain the buffer here since it will be released after the write completes.
|
||||
encoder.writePing(ctx, true, data.retain(), ctx.newPromise());
|
||||
encoder.writePing(ctx, true, data.slice().retain(), ctx.newPromise());
|
||||
|
||||
listener.onPingRead(ctx, data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user