[core] Correctly handle due time of '0' in SmackReactor

Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.

Fixes SMACK-923.
This commit is contained in:
Boris Grozev 2022-02-04 12:29:38 -06:00 committed by Florian Schmaus
parent 5cd7a6c60e
commit 67a5c3a41a
1 changed files with 4 additions and 5 deletions

View File

@ -221,11 +221,10 @@ public class SmackReactor {
selectWait = 0; selectWait = 0;
} else { } else {
selectWait = nextScheduledAction.getTimeToDueMillis(); selectWait = nextScheduledAction.getTimeToDueMillis();
} if (selectWait <= 0) {
// A scheduled action was just released and became ready to execute.
if (selectWait < 0) { return;
// A scheduled action was just released and became ready to execute. }
return;
} }
// Before we call select, we handle the pending the interest Ops. This will not block since no other // Before we call select, we handle the pending the interest Ops. This will not block since no other