do not invoke onPushFailed() on timeout

This commit is contained in:
Daniel Gultsch 2018-05-01 17:35:29 +02:00
parent 8d5a7c79da
commit d3b20544c9
2 changed files with 13 additions and 7 deletions

View File

@ -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,9 +596,14 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
mXmppConnectionService.databaseBackend.updateAccount(account);
}
if (packet.getType() == IqPacket.TYPE.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"));
}
}
}
}
});

View File

@ -2546,15 +2546,15 @@ public class XmppConnectionService extends Service {
public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT && callback != null) {
callback.onPushSucceeded();
} else {
Log.d(Config.LOGTAG, packet.toString());
} else if (packet.getType() == IqPacket.TYPE.ERROR && callback != null) {
callback.onPushFailed();
}
}
});
} else if (callback != null) {
callback.onPushFailed();
}
} else if (callback != null) {
} else if (packet.getType() == IqPacket.TYPE.ERROR && callback != null) {
callback.onPushFailed();
}
}