do not deduplicate disco queries
Conversations used to deduplicate disco queries based on their hash. However that relies on the first query to go through (device to actually respond) and to respond properly (hash matches). Creating a proper retry behaviour for this is actually quite challanging. (which one would you try next, how long do you wait?)
This commit is contained in:
parent
db447f845e
commit
149224a073
|
@ -64,7 +64,6 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
|
||||||
public static final int OPTION_FIXED_USERNAME = 9;
|
public static final int OPTION_FIXED_USERNAME = 9;
|
||||||
private static final String KEY_PGP_SIGNATURE = "pgp_signature";
|
private static final String KEY_PGP_SIGNATURE = "pgp_signature";
|
||||||
private static final String KEY_PGP_ID = "pgp_id";
|
private static final String KEY_PGP_ID = "pgp_id";
|
||||||
public final HashSet<Pair<String, String>> inProgressDiscoFetches = new HashSet<>();
|
|
||||||
protected final JSONObject keys;
|
protected final JSONObject keys;
|
||||||
private final Roster roster = new Roster(this);
|
private final Roster roster = new Roster(this);
|
||||||
private final Collection<Jid> blocklist = new CopyOnWriteArraySet<>();
|
private final Collection<Jid> blocklist = new CopyOnWriteArraySet<>();
|
||||||
|
|
|
@ -4574,11 +4574,6 @@ public class XmppConnectionService extends Service {
|
||||||
syncRoster(account);
|
syncRoster(account);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (account.inProgressDiscoFetches.contains(key)) {
|
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": skipping duplicate disco request for " + key.second + " to " + jid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
account.inProgressDiscoFetches.add(key);
|
|
||||||
final IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||||
request.setTo(jid);
|
request.setTo(jid);
|
||||||
final String node = presence.getNode();
|
final String node = presence.getNode();
|
||||||
|
@ -4590,7 +4585,7 @@ public class XmppConnectionService extends Service {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
|
||||||
sendIqPacket(account, request, (a, response) -> {
|
sendIqPacket(account, request, (a, response) -> {
|
||||||
if (response.getType() == IqPacket.TYPE.RESULT) {
|
if (response.getType() == IqPacket.TYPE.RESULT) {
|
||||||
ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
|
final ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
|
||||||
if (presence.getVer().equals(discoveryResult.getVer())) {
|
if (presence.getVer().equals(discoveryResult.getVer())) {
|
||||||
databaseBackend.insertDiscoveryResult(discoveryResult);
|
databaseBackend.insertDiscoveryResult(discoveryResult);
|
||||||
injectServiceDiscoveryResult(a.getRoster(), presence.getHash(), presence.getVer(), discoveryResult);
|
injectServiceDiscoveryResult(a.getRoster(), presence.getHash(), presence.getVer(), discoveryResult);
|
||||||
|
@ -4600,7 +4595,6 @@ public class XmppConnectionService extends Service {
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to fetch caps from " + jid);
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to fetch caps from " + jid);
|
||||||
}
|
}
|
||||||
a.inProgressDiscoFetches.remove(key);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue