diff options
author | Frank Zschockelt <gith12@freakysoft.de> | 2014-10-16 23:31:48 +0200 |
---|---|---|
committer | Frank Zschockelt <gith12@freakysoft.de> | 2014-10-16 23:31:48 +0200 |
commit | c725da954c5b2c4a8dc7014f5468bc14ecb5a5f8 (patch) | |
tree | 553aba6ec828d2d5ce1d9c2561366799aa6b89c9 /src/eu/siacs/conversations/xmpp | |
parent | 5e3caf962696d3fe39e7ce70274530aa4f77d134 (diff) |
try all srv responses if necessary
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 21 |
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 43614f50d..9755be6ab 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))) { |