create empty disco result on error to fire advance stream features event
This commit is contained in:
parent
ad15fb1721
commit
ed95dd64ad
|
@ -87,6 +87,18 @@ public class ServiceDiscoveryResult {
|
|||
}
|
||||
}
|
||||
|
||||
private ServiceDiscoveryResult() {
|
||||
this.hash = "sha-1";
|
||||
this.features = Collections.emptyList();
|
||||
this.identities = Collections.emptyList();
|
||||
this.ver = null;
|
||||
this.forms = Collections.emptyList();
|
||||
}
|
||||
|
||||
public static ServiceDiscoveryResult empty() {
|
||||
return new ServiceDiscoveryResult();
|
||||
}
|
||||
|
||||
public ServiceDiscoveryResult(Cursor cursor) throws JSONException {
|
||||
this(
|
||||
cursor.getString(cursor.getColumnIndex(HASH)),
|
||||
|
|
|
@ -1205,8 +1205,21 @@ public class XmppConnection implements Runnable {
|
|||
if (advancedStreamFeaturesLoaded && (jid.equals(Jid.of(account.getServer())) || jid.equals(account.getJid().asBareJid()))) {
|
||||
enableAdvancedStreamFeatures();
|
||||
}
|
||||
} else {
|
||||
} else if (packet.getType() == IqPacket.TYPE.ERROR) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco info for " + jid.toString());
|
||||
final boolean serverOrAccount = jid.equals(Jid.of(account.getServer())) || jid.equals(account.getJid().asBareJid());
|
||||
final boolean advancedStreamFeaturesLoaded;
|
||||
if (serverOrAccount) {
|
||||
synchronized (XmppConnection.this.disco) {
|
||||
disco.put(jid, ServiceDiscoveryResult.empty());
|
||||
advancedStreamFeaturesLoaded = disco.containsKey(Jid.of(account.getServer())) && disco.containsKey(account.getJid().asBareJid());
|
||||
}
|
||||
} else {
|
||||
advancedStreamFeaturesLoaded = false;
|
||||
}
|
||||
if (advancedStreamFeaturesLoaded) {
|
||||
enableAdvancedStreamFeatures();
|
||||
}
|
||||
}
|
||||
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
|
||||
if (mPendingServiceDiscoveries.decrementAndGet() == 0
|
||||
|
|
Loading…
Reference in New Issue