cf171ff52555b9e984a3b9103287f6b897dc8626 Close Regression
Motivation: cf171ff52555b9e984a3b9103287f6b897dc8626 introduced a change in behavior when dealing with closing channel in the read loop. This changed behavior may use stale state to determine if a channel should be shutdown and may be incorrect. Modifications: - Revert the usage of potentially stale state Result: Closing a channel in the read loop is based upon current state instead of potentially stale state.
This commit is contained in:
parent
15f3b69b9e
commit
99c85ef4f5
@ -884,7 +884,6 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
||||
|
||||
if (close) {
|
||||
shutdownInput();
|
||||
close = false;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
handleReadException(pipeline, byteBuf, t, close, allocHandle);
|
||||
|
@ -105,6 +105,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
allocHandle.reset(config);
|
||||
|
||||
ByteBuf byteBuf = null;
|
||||
boolean close = false;
|
||||
try {
|
||||
boolean needReadPendingReset = true;
|
||||
do {
|
||||
@ -114,6 +115,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
// nothing was read. release the buffer.
|
||||
byteBuf.release();
|
||||
byteBuf = null;
|
||||
close = allocHandle.lastBytesRead() < 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -129,11 +131,11 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
allocHandle.readComplete();
|
||||
pipeline.fireChannelReadComplete();
|
||||
|
||||
if (allocHandle.lastBytesRead() < 0) {
|
||||
if (close) {
|
||||
closeOnRead(pipeline);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
handleReadException(pipeline, byteBuf, t, allocHandle.lastBytesRead() < 0, allocHandle);
|
||||
handleReadException(pipeline, byteBuf, t, close, allocHandle);
|
||||
} finally {
|
||||
// Check if there is a readPending which was not processed yet.
|
||||
// This could be for two reasons:
|
||||
|
Loading…
x
Reference in New Issue
Block a user