do not run through connection loop after thread was interrupted and resolver returned 0 results
This commit is contained in:
parent
6121217df5
commit
681ce91ab8
|
@ -123,9 +123,7 @@ public class Resolver {
|
|||
for(Thread thread : threads) {
|
||||
thread.interrupt();
|
||||
}
|
||||
synchronized (results) {
|
||||
return new ArrayList<>(results);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ import eu.siacs.conversations.utils.Resolver;
|
|||
import eu.siacs.conversations.utils.SSLSocketHelper;
|
||||
import eu.siacs.conversations.utils.SocksSocketFactory;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xml.Namespace;
|
||||
import eu.siacs.conversations.xml.Tag;
|
||||
import eu.siacs.conversations.xml.TagWriter;
|
||||
import eu.siacs.conversations.xml.XmlReader;
|
||||
import eu.siacs.conversations.xml.Namespace;
|
||||
import eu.siacs.conversations.xmpp.forms.Data;
|
||||
import eu.siacs.conversations.xmpp.forms.Field;
|
||||
import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived;
|
||||
|
@ -177,7 +177,6 @@ public class XmppConnection implements Runnable {
|
|||
private CountDownLatch mStreamCountDownLatch;
|
||||
|
||||
|
||||
|
||||
public XmppConnection(final Account account, final XmppConnectionService service) {
|
||||
this.account = account;
|
||||
this.mXmppConnectionService = service;
|
||||
|
@ -331,17 +330,20 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
} else {
|
||||
final String domain = account.getJid().getDomain();
|
||||
List<Resolver.Result> results = Resolver.resolve(account.getJid().getDomain());
|
||||
Resolver.Result storedBackupResult;
|
||||
if (!Thread.currentThread().isInterrupted()) {
|
||||
storedBackupResult = mXmppConnectionService.databaseBackend.findResolverResult(domain);
|
||||
final List<Resolver.Result> results = Resolver.resolve(account.getJid().getDomain());
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": Thread was interrupted");
|
||||
return;
|
||||
}
|
||||
if (results.size() == 0) {
|
||||
Log.e(Config.LOGTAG,account.getJid().asBareJid()+": Resolver results were empty");
|
||||
return;
|
||||
}
|
||||
final Resolver.Result storedBackupResult = mXmppConnectionService.databaseBackend.findResolverResult(domain);
|
||||
if (storedBackupResult != null && !results.contains(storedBackupResult)) {
|
||||
results.add(storedBackupResult);
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": loaded backup resolver result from db: " + storedBackupResult);
|
||||
}
|
||||
} else {
|
||||
storedBackupResult = null;
|
||||
}
|
||||
for (Iterator<Resolver.Result> iterator = results.iterator(); iterator.hasNext(); ) {
|
||||
final Resolver.Result result = iterator.next();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
|
|
Loading…
Reference in a new issue