request disco items before disco#info on first connect

should make initial connect faster because code is not waiting for omemo code to run
This commit is contained in:
Daniel Gultsch 2018-02-20 17:36:07 +01:00
parent e7094af9d5
commit f81e5e471e

View file

@ -1203,6 +1203,10 @@ public class XmppConnection implements Runnable {
if (hash != null && ver != null) { if (hash != null && ver != null) {
discoveryResult = mXmppConnectionService.getCachedServiceDiscoveryResult(new Pair<>(hash, ver)); discoveryResult = mXmppConnectionService.getCachedServiceDiscoveryResult(new Pair<>(hash, ver));
} }
final boolean requestDiscoItemsFirst = !account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
if (requestDiscoItemsFirst) {
sendServiceDiscoveryItems(account.getServer());
}
if (discoveryResult == null) { if (discoveryResult == null) {
sendServiceDiscoveryInfo(account.getServer()); sendServiceDiscoveryInfo(account.getServer());
} else { } else {
@ -1210,7 +1214,9 @@ public class XmppConnection implements Runnable {
disco.put(account.getServer(), discoveryResult); disco.put(account.getServer(), discoveryResult);
} }
sendServiceDiscoveryInfo(account.getJid().toBareJid()); sendServiceDiscoveryInfo(account.getJid().toBareJid());
if (!requestDiscoItemsFirst) {
sendServiceDiscoveryItems(account.getServer()); sendServiceDiscoveryItems(account.getServer());
}
if (!mWaitForDisco.get()) { if (!mWaitForDisco.get()) {
finalizeBind(); finalizeBind();