aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xmpp
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-21 21:20:59 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-21 21:29:00 +0100
commit062e51bdccde6f72d9c7cacc8408ec3b2827fa8d (patch)
tree872147770eee51865fca09852add112cddee87e8 /src/main/java/de/pixart/messenger/xmpp
parentea8ca07e11770399eb9b4cfc3649d6fe574da1c3 (diff)
permanently cache last resolver result
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 58329609a..c6b913677 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -380,7 +380,18 @@ public class XmppConnection implements Runnable {
throw new IOException(e.getMessage());
}
} else {
+ final String domain = account.getJid().getDomainpart();
List<Resolver.Result> results = Resolver.resolve(account.getJid().getDomainpart());
+ Resolver.Result storedBackupResult;
+ if (!Thread.currentThread().isInterrupted()) {
+ storedBackupResult = mXmppConnectionService.databaseBackend.findResolverResult(domain);
+ if (storedBackupResult != null && !results.contains(storedBackupResult)) {
+ results.add(storedBackupResult);
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": 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()) {
@@ -430,6 +441,9 @@ public class XmppConnection implements Runnable {
}
if (startXmpp(localSocket)) {
+ if (!result.equals(storedBackupResult)) {
+ mXmppConnectionService.databaseBackend.saveResolverResult(domain, result);
+ }
break; // successfully connected to server that speaks xmpp
} else {
localSocket.close();