Only set lastReadTime if an read actually happened before in IdleStateHandler.
Motivation: IdleStateHandler and ReadTimeoutHandler could mistakely not fire an event even if no channelRead(...) call happened. Modifications: Only set lastReadTime if a read happened before. Result: More correct IdleStateHandler / ReadTimeoutHandler.
This commit is contained in:
parent
ad71fd54c9
commit
1a457ec269
@ -268,7 +268,7 @@ public class IdleStateHandler extends ChannelDuplexHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
||||||
if (readerIdleTimeNanos > 0 || allIdleTimeNanos > 0) {
|
if ((readerIdleTimeNanos > 0 || allIdleTimeNanos > 0) && reading) {
|
||||||
lastReadTime = System.nanoTime();
|
lastReadTime = System.nanoTime();
|
||||||
reading = false;
|
reading = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user