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:
Daniel Gultsch 2021-02-17 18:14:14 +01:00
parent db447f845e
commit 149224a073
2 changed files with 1 additions and 8 deletions

View File

@ -64,7 +64,6 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
public static final int OPTION_FIXED_USERNAME = 9;
private static final String KEY_PGP_SIGNATURE = "pgp_signature";
private static final String KEY_PGP_ID = "pgp_id";
public final HashSet<Pair<String, String>> inProgressDiscoFetches = new HashSet<>();
protected final JSONObject keys;
private final Roster roster = new Roster(this);
private final Collection<Jid> blocklist = new CopyOnWriteArraySet<>();

View File

@ -4574,11 +4574,6 @@ public class XmppConnectionService extends Service {
syncRoster(account);
}
} 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);
request.setTo(jid);
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);
sendIqPacket(account, request, (a, response) -> {
if (response.getType() == IqPacket.TYPE.RESULT) {
ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
final ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
if (presence.getVer().equals(discoveryResult.getVer())) {
databaseBackend.insertDiscoveryResult(discoveryResult);
injectServiceDiscoveryResult(a.getRoster(), presence.getHash(), presence.getVer(), discoveryResult);
@ -4600,7 +4595,6 @@ public class XmppConnectionService extends Service {
} else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to fetch caps from " + jid);
}
a.inProgressDiscoFetches.remove(key);
});
}
}