From 149224a07365c6ac5bb88c746e5cc0fac007bc91 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 17 Feb 2021 18:14:14 +0100 Subject: [PATCH] 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?) --- .../java/eu/siacs/conversations/entities/Account.java | 1 - .../conversations/services/XmppConnectionService.java | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index bd71dc9fa..ce39aa737 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -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> inProgressDiscoFetches = new HashSet<>(); protected final JSONObject keys; private final Roster roster = new Roster(this); private final Collection blocklist = new CopyOnWriteArraySet<>(); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index f02a4cde2..65b082abe 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -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); }); } }