mirror of https://github.com/grpc/grpc-java.git
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:
parent
64176d5560
commit
68cba971af
|
|
@ -80,11 +80,6 @@ class BufferingHttp2ConnectionEncoder extends DecoratingHttp2ConnectionEncoder {
|
||||||
super(delegate);
|
super(delegate);
|
||||||
connection().addListener(new Http2ConnectionAdapter() {
|
connection().addListener(new Http2ConnectionAdapter() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGoAwaySent(int lastStreamId, long errorCode, ByteBuf debugData) {
|
|
||||||
cancelGoAwayStreams(lastStreamId, errorCode, debugData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) {
|
public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) {
|
||||||
cancelGoAwayStreams(lastStreamId, errorCode, debugData);
|
cancelGoAwayStreams(lastStreamId, errorCode, debugData);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class BufferingHttp2ConnectionEncoderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendingGoAwayCompletesBufferedStreams() {
|
public void sendingGoAwayShouldNotFailStreams() {
|
||||||
connection.local().maxActiveStreams(1);
|
connection.local().maxActiveStreams(1);
|
||||||
|
|
||||||
encoderWriteHeaders(3, promise);
|
encoderWriteHeaders(3, promise);
|
||||||
|
|
@ -197,8 +197,7 @@ public class BufferingHttp2ConnectionEncoderTest {
|
||||||
encoder.writeGoAway(ctx, 3, CANCEL.code(), empty, promise);
|
encoder.writeGoAway(ctx, 3, CANCEL.code(), empty, promise);
|
||||||
|
|
||||||
assertEquals(1, connection.numActiveStreams());
|
assertEquals(1, connection.numActiveStreams());
|
||||||
// The 2 buffered streams should be completed.
|
verify(promise, never()).setFailure(any(GoAwayClosedStreamException.class));
|
||||||
verify(promise, times(2)).setFailure(any(GoAwayClosedStreamException.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue