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
97617b254b
commit
1837209a87
@ -46,6 +46,7 @@ import io.netty.util.internal.UnstableApi;
|
|||||||
import io.netty.util.internal.logging.InternalLogger;
|
import io.netty.util.internal.logging.InternalLogger;
|
||||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.nio.channels.ClosedChannelException;
|
import java.nio.channels.ClosedChannelException;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -1166,11 +1167,13 @@ public class Http2MultiplexCodec extends Http2FrameCodec {
|
|||||||
promise.setSuccess();
|
promise.setSuccess();
|
||||||
} else {
|
} else {
|
||||||
Throwable error = wrapStreamClosedError(cause);
|
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()) {
|
if (config.isAutoClose()) {
|
||||||
// Close channel if needed.
|
// Close channel if needed.
|
||||||
closeForcibly();
|
closeForcibly();
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: Once Http2StreamChannel extends DuplexChannel we should call shutdownOutput(...)
|
||||||
outboundClosed = true;
|
outboundClosed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user