aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-19 20:19:35 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-19 20:19:35 +0200
commit9372a98c0c42c9bbd1a4ea6a701cc21fcca05354 (patch)
tree0cd7373a9356d8c841520be41a17c75ac9d4464d
parent713cd6ef89e9abd6046a8c1d9be56a2c47518033 (diff)
parentf824193c56308806c56b6ca526deb529941806a4 (diff)
Merge branch 'lactide-srv_fix' into development
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index 43614f50..9755be6a 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -161,10 +161,23 @@ public class XmppConnection implements Runnable {
+ "[" + srvIpServer + "]:" + srvRecordPort);
socket = new Socket(srvIpServer, srvRecordPort);
} else {
- Log.d(Config.LOGTAG, account.getJid()
- + ": using values from dns " + srvRecordServer
- + ":" + srvRecordPort);
- socket = new Socket(srvRecordServer, srvRecordPort);
+ boolean socketError = true;
+ int srvIndex = 0;
+ while (socketError && namePort.containsKey("name" + srvIndex)){
+ try {
+ srvRecordServer = namePort.getString("name" + srvIndex);
+ srvRecordPort = namePort.getInt("port" + srvIndex);
+ Log.d(Config.LOGTAG, account.getJid()
+ + ": using values from dns " + srvRecordServer
+ + ":" + srvRecordPort);
+ socket = new Socket(srvRecordServer, srvRecordPort);
+ socketError = false;
+ } catch (UnknownHostException e) {
+ srvIndex++;
+ } catch (IOException e) {
+ srvIndex++;
+ }
+ }
}
} else if (namePort.containsKey("error")
&& "nosrv".equals(namePort.getString("error", null))) {