mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-25 02:02:16 -05:00
try all srv responses if necessary
This commit is contained in:
parent
5e3caf9626
commit
c725da954c
@ -161,10 +161,23 @@ public class XmppConnection implements Runnable {
|
||||
+ "[" + srvIpServer + "]:" + srvRecordPort);
|
||||
socket = new Socket(srvIpServer, srvRecordPort);
|
||||
} else {
|
||||
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))) {
|
||||
|
Loading…
Reference in New Issue
Block a user