mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 09:42:17 -05:00
no dns retry after nosrv error
This commit is contained in:
parent
d5e62ffe89
commit
5371dd025a
@ -30,17 +30,16 @@ public class DNSHelper {
|
|||||||
String dns[] = client.findDNS();
|
String dns[] = client.findDNS();
|
||||||
|
|
||||||
if (dns != null) {
|
if (dns != null) {
|
||||||
// we have a list of DNS servers, let's go
|
|
||||||
for (String dnsserver : dns) {
|
for (String dnsserver : dns) {
|
||||||
InetAddress ip = InetAddress.getByName(dnsserver);
|
InetAddress ip = InetAddress.getByName(dnsserver);
|
||||||
Bundle b = queryDNS(host, ip);
|
Bundle b = queryDNS(host, ip);
|
||||||
if (b.containsKey("name")) {
|
if (b.containsKey("name")) {
|
||||||
return b;
|
return b;
|
||||||
|
} else if (b.containsKey("error") && "nosrv".equals(b.getString("error", null))) {
|
||||||
|
return b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback
|
|
||||||
return queryDNS(host, InetAddress.getByName("8.8.8.8"));
|
return queryDNS(host, InetAddress.getByName("8.8.8.8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,10 +163,8 @@ public class DNSHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
Log.d(Config.LOGTAG, "timeout during dns");
|
|
||||||
namePort.putString("error", "timeout");
|
namePort.putString("error", "timeout");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(Config.LOGTAG, "unhandled exception in sub project");
|
|
||||||
namePort.putString("error", "unhandled");
|
namePort.putString("error", "unhandled");
|
||||||
}
|
}
|
||||||
return namePort;
|
return namePort;
|
||||||
|
@ -166,8 +166,12 @@ public class XmppConnection implements Runnable {
|
|||||||
+ ":" + srvRecordPort);
|
+ ":" + srvRecordPort);
|
||||||
socket = new Socket(srvRecordServer, srvRecordPort);
|
socket = new Socket(srvRecordServer, srvRecordPort);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (namePort.containsKey("error") && "nosrv".equals(namePort.getString("error", null))) {
|
||||||
socket = new Socket(account.getServer(), 5222);
|
socket = new Socket(account.getServer(), 5222);
|
||||||
|
} else {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid()+": timeout in DNS resolution");
|
||||||
|
changeStatus(Account.STATUS_OFFLINE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
OutputStream out = socket.getOutputStream();
|
OutputStream out = socket.getOutputStream();
|
||||||
tagWriter.setOutputStream(out);
|
tagWriter.setOutputStream(out);
|
||||||
|
Loading…
Reference in New Issue
Block a user