Fix a bug in AioSocketChannel where inboundBufferSuspended() is triggered even if the channel is closed.
This commit is contained in:
parent
8cf9f52919
commit
93fd73fbbf
@ -325,6 +325,10 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
||||
inDoBeginRead = true;
|
||||
try {
|
||||
for (;;) {
|
||||
if (inputShutdown) {
|
||||
break;
|
||||
}
|
||||
|
||||
ByteBuf byteBuf = pipeline().inboundByteBuffer();
|
||||
if (!byteBuf.readable()) {
|
||||
byteBuf.discardReadBytes();
|
||||
@ -468,16 +472,16 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
||||
pipeline.fireInboundBufferUpdated();
|
||||
}
|
||||
|
||||
firedInboundBufferSuspended = true;
|
||||
pipeline.fireInboundBufferSuspended();
|
||||
if (!closed && channel.isOpen()) {
|
||||
firedInboundBufferSuspended = true;
|
||||
pipeline.fireInboundBufferSuspended();
|
||||
}
|
||||
|
||||
pipeline.fireExceptionCaught(t);
|
||||
} finally {
|
||||
if (read) {
|
||||
pipeline.fireInboundBufferUpdated();
|
||||
}
|
||||
if (!firedInboundBufferSuspended) {
|
||||
pipeline.fireInboundBufferSuspended();
|
||||
}
|
||||
|
||||
// Double check because fireInboundBufferUpdated() might have triggered the closure by a user handler.
|
||||
if (closed || !channel.isOpen()) {
|
||||
@ -489,6 +493,8 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
||||
channel.unsafe().close(channel.unsafe().voidFuture());
|
||||
}
|
||||
}
|
||||
} else if (!firedInboundBufferSuspended) {
|
||||
pipeline.fireInboundBufferSuspended();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user