From 67a5c3a41a285f1dbcaf97a6cd4f2580036d525b Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Fri, 4 Feb 2022 12:29:38 -0600 Subject: [PATCH] [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. --- .../main/java/org/jivesoftware/smack/SmackReactor.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java index 75e1af8e9..67e68f1fd 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java @@ -221,11 +221,10 @@ public class SmackReactor { selectWait = 0; } else { selectWait = nextScheduledAction.getTimeToDueMillis(); - } - - if (selectWait < 0) { - // A scheduled action was just released and became ready to execute. - return; + if (selectWait <= 0) { + // 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