Skip to content

Commit

Permalink
fix StreamBufferingEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 committed Mar 26, 2021
1 parent f545a2a commit 95060b2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions netty/src/main/java/io/grpc/netty/StreamBufferingEncoder.java
Expand Up @@ -63,6 +63,8 @@
* drop-in decorator of {@link io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder}.
* </p>
*/
// This is a temporary copy of {@link io.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder}
// with a bug fix that is not available yet in the latest netty release.
class StreamBufferingEncoder extends DecoratingHttp2ConnectionEncoder {

/**
Expand Down Expand Up @@ -156,11 +158,7 @@ public ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2
if (closed) {
return promise.setFailure(new Http2ChannelClosedException());
}
if (isExistingStream(streamId) || connection().goAwayReceived()) {
return super.writeHeaders(ctx, streamId, headers, streamDependency, weight,
exclusive, padding, endOfStream, promise);
}
if (canCreateStream()) {
if (isExistingStream(streamId) || canCreateStream()) {
return super.writeHeaders(ctx, streamId, headers, streamDependency, weight,
exclusive, padding, endOfStream, promise);
}
Expand Down

0 comments on commit 95060b2

Please sign in to comment.