From 2e61e0a4d333688187aa257a65bafe6783f80519 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 19 Jul 2017 14:00:15 +0200 Subject: [PATCH] Use Async.go() in OmemoManager's connection listener to prevent a timeout exception since those are executed synchronously. --- .../smackx/omemo/OmemoManager.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java index faff979b0..6a706295b 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java @@ -41,6 +41,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; +import org.jivesoftware.smack.util.Async; import org.jivesoftware.smackx.carbons.CarbonManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; @@ -654,12 +655,18 @@ public final class OmemoManager extends Manager { if (resumed) { return; } - try { - initialize(); - } catch (InterruptedException | CorruptedOmemoKeyException | PubSubException.NotALeafNodeException | SmackException.NotLoggedInException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) { - LOGGER.log(Level.SEVERE, "connectionListener.authenticated() failed to initialize OmemoManager: " - + e.getMessage()); - } + Async.go(new Runnable() { + @Override + public void run() { + try { + initialize(); + } catch (InterruptedException | CorruptedOmemoKeyException | PubSubException.NotALeafNodeException | SmackException.NotLoggedInException | SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException e) { + LOGGER.log(Level.SEVERE, "connectionListener.authenticated() failed to initialize OmemoManager: " + + e.getMessage()); + } + } + }); + } @Override