From ccfbf9f346af16ad3cff6d01847a9cbc6e82ca77 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 24 Nov 2023 12:14:59 +0100 Subject: [PATCH] [caps] Use a synchronous listener for incoming presence stanzas Fixes SMACK-937. --- .../java/org/jivesoftware/smackx/caps/EntityCapsManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index ff3eb0c47..9b736f6d4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -354,7 +354,10 @@ public final class EntityCapsManager extends Manager { if (autoEnableEntityCaps) enableEntityCaps(); - connection.addAsyncStanzaListener(new StanzaListener() { + // Note that this is a *synchronous* stanza listener to avoid unnecessary feature lookups. If this were to be an + // asynchronous listener, then it would be possible that the entity caps information was not processed when the + // features of entity are looked up. See SMACK-937. + connection.addStanzaListener(new StanzaListener() { // Listen for remote presence stanzas with the caps extension // If we receive such a stanza, record the JID and nodeVer @Override