reworked that loop that iterates over various servers
This commit is contained in:
parent
a85bba0010
commit
20ec9ff2c6
|
@ -257,10 +257,8 @@ public class XmppConnection implements Runnable {
|
||||||
} else {
|
} else {
|
||||||
final Bundle result = DNSHelper.getSRVRecord(account.getServer(), mXmppConnectionService);
|
final Bundle result = DNSHelper.getSRVRecord(account.getServer(), mXmppConnectionService);
|
||||||
final ArrayList<Parcelable>values = result.getParcelableArrayList("values");
|
final ArrayList<Parcelable>values = result.getParcelableArrayList("values");
|
||||||
int i = 0;
|
for(Iterator<Parcelable> iterator = values.iterator(); iterator.hasNext();) {
|
||||||
boolean socketError = true;
|
final Bundle namePort = (Bundle) iterator.next();
|
||||||
while (socketError && values.size() > i) {
|
|
||||||
final Bundle namePort = (Bundle) values.get(i);
|
|
||||||
try {
|
try {
|
||||||
String srvRecordServer;
|
String srvRecordServer;
|
||||||
try {
|
try {
|
||||||
|
@ -285,22 +283,18 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
socket = new Socket();
|
socket = new Socket();
|
||||||
socket.connect(addr, Config.SOCKET_TIMEOUT * 1000);
|
socket.connect(addr, Config.SOCKET_TIMEOUT * 1000);
|
||||||
socketError = false;
|
tagWriter.setOutputStream(socket.getOutputStream());
|
||||||
|
tagReader.setInputStream(socket.getInputStream());
|
||||||
|
tagWriter.beginDocument();
|
||||||
|
sendStartStream();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage() +"("+e.getClass().getName()+")");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage() +"("+e.getClass().getName()+")");
|
||||||
i++;
|
if (!iterator.hasNext()) {
|
||||||
}
|
|
||||||
}
|
|
||||||
if (socketError) {
|
|
||||||
throw new UnknownHostException();
|
throw new UnknownHostException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final OutputStream out = socket.getOutputStream();
|
}
|
||||||
tagWriter.setOutputStream(out);
|
}
|
||||||
final InputStream in = socket.getInputStream();
|
|
||||||
tagReader.setInputStream(in);
|
|
||||||
tagWriter.beginDocument();
|
|
||||||
sendStartStream();
|
|
||||||
Tag nextTag;
|
Tag nextTag;
|
||||||
while ((nextTag = tagReader.readTag()) != null) {
|
while ((nextTag = tagReader.readTag()) != null) {
|
||||||
if (nextTag.isStart("stream")) {
|
if (nextTag.isStart("stream")) {
|
||||||
|
|
Loading…
Reference in New Issue