Fixed a case where HashedWheelTimer notifies a timeout one round later
This commit is contained in:
parent
bb6f5a6104
commit
afb7e511ad
@ -309,12 +309,12 @@ public class HashedWheelTimer implements Timer {
|
|||||||
List<HashedWheelTimeout> expiredTimeouts,
|
List<HashedWheelTimeout> expiredTimeouts,
|
||||||
ReusableIterator<HashedWheelTimeout> i) {
|
ReusableIterator<HashedWheelTimeout> i) {
|
||||||
|
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentDeadline = System.currentTimeMillis() + tickDuration;
|
||||||
i.rewind();
|
i.rewind();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
HashedWheelTimeout timeout = i.next();
|
HashedWheelTimeout timeout = i.next();
|
||||||
if (timeout.remainingRounds <= 0) {
|
if (timeout.remainingRounds <= 0) {
|
||||||
if (timeout.deadline <= currentTime) {
|
if (timeout.deadline < currentDeadline) {
|
||||||
i.remove();
|
i.remove();
|
||||||
expiredTimeouts.add(timeout);
|
expiredTimeouts.add(timeout);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user