aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-12-14 18:31:52 +0100
committeriNPUTmice <daniel@gultsch.de>2014-12-14 18:31:52 +0100
commit50410dad334643945e4978117d81dc3cbf4c3157 (patch)
treee02b56b7b93a377e888c296aafc3b13eec1679e2 /src/main/java/eu/siacs/conversations
parentde06cb38d190e9853e8557e07eaff1c8ba881e2a (diff)
possible dns fixes
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/DNSHelper.java13
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
index 8c1a8dea3..2aa6f5738 100644
--- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
@@ -143,12 +143,21 @@ public class DNSHelper {
Bundle namePort = new Bundle();
namePort.putString("name", srv.getName());
namePort.putInt("port", srv.getPort());
+ if (ips6.containsKey(srv.getName())) {
+ ArrayList<String> ip = ips6.get(srv.getName());
+ Collections.shuffle(ip, rnd);
+ namePort.putString("ip", ip.get(0));
+ values.add(namePort);
+ }
if (ips4.containsKey(srv.getName())) {
ArrayList<String> ip = ips4.get(srv.getName());
Collections.shuffle(ip, rnd);
- namePort.putString("ipv4", ip.get(0));
+ namePort.putString("ip", ip.get(0));
+ values.add(namePort);
+ }
+ if (!ips6.containsKey(srv.getName()) && !ips4.containsKey(srv.getName())) {
+ values.add(namePort);
}
- values.add(namePort);
}
bundle.putParcelableArrayList("values", values);
} catch (SocketTimeoutException e) {
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index af0499c64..b090d651a 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -171,7 +171,7 @@ public class XmppConnection implements Runnable {
srvRecordServer = "";
}
int srvRecordPort = namePort.getInt("port");
- String srvIpServer = namePort.getString("ipv4");
+ String srvIpServer = namePort.getString("ip");
InetSocketAddress addr;
if (srvIpServer != null) {
addr = new InetSocketAddress(srvIpServer, srvRecordPort);