don't retry building broken omemo keys

This commit is contained in:
Daniel Gultsch 2015-10-17 15:51:21 +02:00
parent 0f405c2e11
commit 3c6c424d31

View file

@ -179,6 +179,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
PENDING, PENDING,
SUCCESS, SUCCESS,
SUCCESS_VERIFIED, SUCCESS_VERIFIED,
TIMEOUT,
ERROR ERROR
} }
@ -643,7 +644,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT) { if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
fetchStatusMap.put(address, FetchStatus.TIMEOUT);
} else if (packet.getType() == IqPacket.TYPE.RESULT) {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Received preKey IQ packet, processing..."); Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Received preKey IQ packet, processing...");
final IqParser parser = mXmppConnectionService.getIqParser(); final IqParser parser = mXmppConnectionService.getIqParser();
final List<PreKeyBundle> preKeyBundleList = parser.preKeys(packet); final List<PreKeyBundle> preKeyBundleList = parser.preKeys(packet);
@ -715,7 +718,11 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
sessions.put(address, session); sessions.put(address, session);
} else { } else {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Found device " + account.getJid().toBareJid() + ":" + foreignId); Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Found device " + account.getJid().toBareJid() + ":" + foreignId);
addresses.add(new AxolotlAddress(contactJid.toString(), foreignId)); if (fetchStatusMap.get(address) != FetchStatus.ERROR) {
addresses.add(address);
} else {
Log.d(Config.LOGTAG,getLogprefix(account)+"skipping over "+address+" because it's broken");
}
} }
} }
} }
@ -733,7 +740,11 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
sessions.put(address, session); sessions.put(address, session);
} else { } else {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Found device " + account.getJid().toBareJid() + ":" + ownId); Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Found device " + account.getJid().toBareJid() + ":" + ownId);
addresses.add(new AxolotlAddress(account.getJid().toBareJid().toString(), ownId)); if (fetchStatusMap.get(address) != FetchStatus.ERROR) {
addresses.add(address);
} else {
Log.d(Config.LOGTAG,getLogprefix(account)+"skipping over "+address+" because it's broken");
}
} }
} }
} }
@ -749,7 +760,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
for (AxolotlAddress address : addresses) { for (AxolotlAddress address : addresses) {
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Processing device: " + address.toString()); Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Processing device: " + address.toString());
FetchStatus status = fetchStatusMap.get(address); FetchStatus status = fetchStatusMap.get(address);
if (status == null || status == FetchStatus.ERROR) { if (status == null || status == FetchStatus.TIMEOUT) {
fetchStatusMap.put(address, FetchStatus.PENDING); fetchStatusMap.put(address, FetchStatus.PENDING);
this.buildSessionFromPEP(address); this.buildSessionFromPEP(address);
newSessions = true; newSessions = true;