Http2MultiplexCodec.DefaultHttp2StreamChannel should handle ChannelConfig.isAutoClose() in a consistent way as AbstractChannel (#9108)
Motivation: Http2MultiplexCodec.DefaultHttp2StreamChannel currently only act on ClosedChannelException exceptions when checking for isAutoClose(). We should widen the scope here to IOException to be more consistent with AbstractChannel. Modifications: Replace instanceof ClosedChannelException with instanceof IOException Result: More consistent handling of isAutoClose()
This commit is contained in:
parent
6de098bae8
commit
a4b05694d3
@ -46,6 +46,7 @@ import io.netty.util.internal.UnstableApi;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.util.ArrayDeque;
|
||||
@ -1153,11 +1154,13 @@ public class Http2MultiplexCodec extends Http2FrameCodec {
|
||||
promise.setSuccess();
|
||||
} else {
|
||||
Throwable error = wrapStreamClosedError(cause);
|
||||
if (error instanceof ClosedChannelException) {
|
||||
// To make it more consistent with AbstractChannel we handle all IOExceptions here.
|
||||
if (error instanceof IOException) {
|
||||
if (config.isAutoClose()) {
|
||||
// Close channel if needed.
|
||||
closeForcibly();
|
||||
} else {
|
||||
// TODO: Once Http2StreamChannel extends DuplexChannel we should call shutdownOutput(...)
|
||||
outboundClosed = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user