Do not fail pending streams when sending GOAWAY.

If the HEADERS have been written to the buffering encoder we should
allow their creation to complete since the HTTP/2 spec does not prohibit
this.
This commit is contained in:
nmittler 2015-05-04 12:54:42 -07:00
parent 64176d5560
commit 68cba971af
2 changed files with 2 additions and 8 deletions

View File

@ -80,11 +80,6 @@ class BufferingHttp2ConnectionEncoder extends DecoratingHttp2ConnectionEncoder {
super(delegate);
connection().addListener(new Http2ConnectionAdapter() {
@Override
public void onGoAwaySent(int lastStreamId, long errorCode, ByteBuf debugData) {
cancelGoAwayStreams(lastStreamId, errorCode, debugData);
}
@Override
public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) {
cancelGoAwayStreams(lastStreamId, errorCode, debugData);

View File

@ -186,7 +186,7 @@ public class BufferingHttp2ConnectionEncoderTest {
}
@Test
public void sendingGoAwayCompletesBufferedStreams() {
public void sendingGoAwayShouldNotFailStreams() {
connection.local().maxActiveStreams(1);
encoderWriteHeaders(3, promise);
@ -197,8 +197,7 @@ public class BufferingHttp2ConnectionEncoderTest {
encoder.writeGoAway(ctx, 3, CANCEL.code(), empty, promise);
assertEquals(1, connection.numActiveStreams());
// The 2 buffered streams should be completed.
verify(promise, times(2)).setFailure(any(GoAwayClosedStreamException.class));
verify(promise, never()).setFailure(any(GoAwayClosedStreamException.class));
}
@Test