cf171ff525
Close Regression
Motivation:
cf171ff525
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) {
|
if (close) {
|
||||||
shutdownInput();
|
shutdownInput();
|
||||||
close = false;
|
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
handleReadException(pipeline, byteBuf, t, close, allocHandle);
|
handleReadException(pipeline, byteBuf, t, close, allocHandle);
|
||||||
|
@ -105,6 +105,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
allocHandle.reset(config);
|
allocHandle.reset(config);
|
||||||
|
|
||||||
ByteBuf byteBuf = null;
|
ByteBuf byteBuf = null;
|
||||||
|
boolean close = false;
|
||||||
try {
|
try {
|
||||||
boolean needReadPendingReset = true;
|
boolean needReadPendingReset = true;
|
||||||
do {
|
do {
|
||||||
@ -114,6 +115,7 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
// nothing was read. release the buffer.
|
// nothing was read. release the buffer.
|
||||||
byteBuf.release();
|
byteBuf.release();
|
||||||
byteBuf = null;
|
byteBuf = null;
|
||||||
|
close = allocHandle.lastBytesRead() < 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,11 +131,11 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
allocHandle.readComplete();
|
allocHandle.readComplete();
|
||||||
pipeline.fireChannelReadComplete();
|
pipeline.fireChannelReadComplete();
|
||||||
|
|
||||||
if (allocHandle.lastBytesRead() < 0) {
|
if (close) {
|
||||||
closeOnRead(pipeline);
|
closeOnRead(pipeline);
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
handleReadException(pipeline, byteBuf, t, allocHandle.lastBytesRead() < 0, allocHandle);
|
handleReadException(pipeline, byteBuf, t, close, allocHandle);
|
||||||
} finally {
|
} finally {
|
||||||
// Check if there is a readPending which was not processed yet.
|
// Check if there is a readPending which was not processed yet.
|
||||||
// This could be for two reasons:
|
// This could be for two reasons:
|
||||||
|
Loading…
Reference in New Issue
Block a user