Let Http2ConnectionHandler close stream with voidPromise (#10819)
Motivation: Http2ConnectionHandler tries to addListener to the future without checking if it's void. If it is void, this will fail and generate an exception. Modifications: Unvoid the promise in writeData() Result: Fixes #10816, Writing with a voidPromise no longer generates exceptions.
This commit is contained in:
parent
c41d46111d
commit
b27f0fccce
@ -120,6 +120,7 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder, Ht
|
||||
@Override
|
||||
public ChannelFuture writeData(final ChannelHandlerContext ctx, final int streamId, ByteBuf data, int padding,
|
||||
final boolean endOfStream, ChannelPromise promise) {
|
||||
promise = promise.unvoid();
|
||||
final Http2Stream stream;
|
||||
try {
|
||||
stream = requireStream(streamId);
|
||||
|
@ -691,6 +691,14 @@ public class Http2ConnectionHandlerTest {
|
||||
verify(pipeline).fireExceptionCaught(cause);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canCloseStreamWithVoidPromise() throws Exception {
|
||||
handler = newHandler();
|
||||
handler.closeStream(stream, ctx.voidPromise());
|
||||
verify(stream, times(1)).close();
|
||||
verifyNoMoreInteractions(stream);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void channelReadCompleteTriggersFlush() throws Exception {
|
||||
handler = newHandler();
|
||||
|
Loading…
Reference in New Issue
Block a user