diff --git a/testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketTestPermutation.java b/testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketTestPermutation.java index 8716f5ea8b..ac6641b259 100644 --- a/testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketTestPermutation.java +++ b/testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketTestPermutation.java @@ -29,7 +29,12 @@ import io.netty.channel.socket.nio.NioSctpChannel; import io.netty.channel.socket.nio.NioSctpServerChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.channel.socket.oio.*; +import io.netty.channel.socket.oio.OioDatagramChannel; +import io.netty.channel.socket.oio.OioEventLoopGroup; +import io.netty.channel.socket.oio.OioSctpChannel; +import io.netty.channel.socket.oio.OioSctpServerChannel; +import io.netty.channel.socket.oio.OioServerSocketChannel; +import io.netty.channel.socket.oio.OioSocketChannel; import io.netty.testsuite.util.TestUtils; import java.util.ArrayList; diff --git a/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannel.java b/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannel.java index 81e22eb3aa..df64885989 100755 --- a/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/aio/AioSocketChannel.java @@ -493,7 +493,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne channel.unsafe().close(channel.unsafe().voidFuture()); } } - } else if (!firedInboundBufferSuspended) { + } else if (!firedInboundBufferSuspended) { pipeline.fireInboundBufferSuspended(); } } diff --git a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioByteChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioByteChannel.java index d498ce23ec..5eda70c253 100755 --- a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioByteChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioByteChannel.java @@ -17,11 +17,11 @@ package io.netty.channel.socket.nio; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; -import io.netty.channel.ChannelPromise; -import io.netty.channel.socket.ChannelInputShutdownEvent; import io.netty.channel.ChannelOption; import io.netty.channel.ChannelPipeline; +import io.netty.channel.ChannelPromise; import io.netty.channel.FileRegion; +import io.netty.channel.socket.ChannelInputShutdownEvent; import java.io.IOException; import java.nio.channels.ClosedChannelException; @@ -100,20 +100,17 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel { pipeline.fireInboundBufferUpdated(); } - firedInboundBufferSuspended = true; - pipeline.fireInboundBufferSuspended(); - - pipeline().fireExceptionCaught(t); if (t instanceof IOException) { - close(voidFuture()); + closed = true; + } else if (!closed) { + firedInboundBufferSuspended = true; + pipeline.fireInboundBufferSuspended(); } + pipeline().fireExceptionCaught(t); } finally { if (read) { pipeline.fireInboundBufferUpdated(); } - if (!firedInboundBufferSuspended) { - pipeline.fireInboundBufferSuspended(); - } if (closed) { setInputShutdown(); @@ -124,6 +121,8 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel { close(voidFuture()); } } + } else if (!firedInboundBufferSuspended) { + pipeline.fireInboundBufferSuspended(); } } } diff --git a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioMessageChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioMessageChannel.java index c9165131a0..373f223662 100755 --- a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioMessageChannel.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioMessageChannel.java @@ -71,22 +71,22 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel { pipeline.fireInboundBufferUpdated(); } - firedInboundBufferSuspended = true; - pipeline.fireInboundBufferSuspended(); + if (t instanceof IOException) { + closed = true; + } else if (!closed) { + firedInboundBufferSuspended = true; + pipeline.fireInboundBufferSuspended(); + } pipeline().fireExceptionCaught(t); - if (t instanceof IOException) { - close(voidFuture()); - } } finally { if (read) { pipeline.fireInboundBufferUpdated(); } - if (!firedInboundBufferSuspended) { - pipeline.fireInboundBufferSuspended(); - } if (closed && isOpen()) { close(voidFuture()); + } else if (!firedInboundBufferSuspended) { + pipeline.fireInboundBufferSuspended(); } } }