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;
|
inDoBeginRead = true;
|
||||||
try {
|
try {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
if (inputShutdown) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuf byteBuf = pipeline().inboundByteBuffer();
|
ByteBuf byteBuf = pipeline().inboundByteBuffer();
|
||||||
if (!byteBuf.readable()) {
|
if (!byteBuf.readable()) {
|
||||||
byteBuf.discardReadBytes();
|
byteBuf.discardReadBytes();
|
||||||
@ -468,16 +472,16 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
pipeline.fireInboundBufferUpdated();
|
pipeline.fireInboundBufferUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
firedInboundBufferSuspended = true;
|
if (!closed && channel.isOpen()) {
|
||||||
pipeline.fireInboundBufferSuspended();
|
firedInboundBufferSuspended = true;
|
||||||
|
pipeline.fireInboundBufferSuspended();
|
||||||
|
}
|
||||||
|
|
||||||
pipeline.fireExceptionCaught(t);
|
pipeline.fireExceptionCaught(t);
|
||||||
} finally {
|
} finally {
|
||||||
if (read) {
|
if (read) {
|
||||||
pipeline.fireInboundBufferUpdated();
|
pipeline.fireInboundBufferUpdated();
|
||||||
}
|
}
|
||||||
if (!firedInboundBufferSuspended) {
|
|
||||||
pipeline.fireInboundBufferSuspended();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Double check because fireInboundBufferUpdated() might have triggered the closure by a user handler.
|
// Double check because fireInboundBufferUpdated() might have triggered the closure by a user handler.
|
||||||
if (closed || !channel.isOpen()) {
|
if (closed || !channel.isOpen()) {
|
||||||
@ -489,6 +493,8 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
|||||||
channel.unsafe().close(channel.unsafe().voidFuture());
|
channel.unsafe().close(channel.unsafe().voidFuture());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (!firedInboundBufferSuspended) {
|
||||||
|
pipeline.fireInboundBufferSuspended();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user