From dbb0cfac4bf7870093c5033e31bfff6ca71b11d4 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 2 May 2018 22:08:15 +0200 Subject: do not invoke onPushFailed() on timeout --- .../de/pixart/messenger/crypto/axolotl/AxolotlService.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java') diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java index 989fe90a4..a4884e60a 100644 --- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java +++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java @@ -574,8 +574,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { mXmppConnectionService.sendIqPacket(account, publish, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { - Element error = packet.getType() == IqPacket.TYPE.ERROR ? packet.findChild("error") : null; - if (firstAttempt && error != null && error.hasChild("precondition-not-met", Namespace.PUBSUB_ERROR)) { + final Element error = packet.getType() == IqPacket.TYPE.ERROR ? packet.findChild("error") : null; + final boolean preConditionNotMet = error != null && error.hasChild("precondition-not-met", Namespace.PUBSUB_ERROR); + if (firstAttempt && preConditionNotMet) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": precondition wasn't met for device list. pushing node configuration"); mXmppConnectionService.pushNodeConfiguration(account, AxolotlService.PEP_DEVICE_LIST, publishOptions, new XmppConnectionService.OnConfigurationPushed() { @Override @@ -595,8 +596,12 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { mXmppConnectionService.databaseBackend.updateAccount(account); } if (packet.getType() == IqPacket.TYPE.ERROR) { - pepBroken = true; - Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error")); + if (preConditionNotMet) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": pre condition still not met on second attempt"); + } else if (error != null) { + pepBroken = true; + Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error")); + } } } } -- cgit v1.2.3