mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 03:32:15 -05:00
treat dns timeouts as temporary. also increased timeout
This commit is contained in:
parent
268eae7813
commit
38efb84690
@ -31,7 +31,7 @@ public class DNSHelper {
|
|||||||
ip = InetAddress.getByName(value);
|
ip = InetAddress.getByName(value);
|
||||||
servers.add(value);
|
servers.add(value);
|
||||||
Bundle result = queryDNS(host, ip);
|
Bundle result = queryDNS(host, ip);
|
||||||
if (!result.containsKey("error")) {
|
if (!result.containsKey("error")||("nosrv".equals(result.getString("error")))) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class DNSHelper {
|
|||||||
|
|
||||||
DatagramPacket receivePacket = new DatagramPacket(receiveData,
|
DatagramPacket receivePacket = new DatagramPacket(receiveData,
|
||||||
receiveData.length);
|
receiveData.length);
|
||||||
datagramSocket.setSoTimeout(3000);
|
datagramSocket.setSoTimeout(7000); //die sieben ist meine zahl
|
||||||
datagramSocket.receive(receivePacket);
|
datagramSocket.receive(receivePacket);
|
||||||
if (receiveData[3] != -128) {
|
if (receiveData[3] != -128) {
|
||||||
namePort.putString("error", "nosrv");
|
namePort.putString("error", "nosrv");
|
||||||
@ -117,7 +117,7 @@ public class DNSHelper {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d("xmppService", "io execpiton during dns");
|
Log.d("xmppService", "io execpiton during dns");
|
||||||
namePort.putString("error", "nosrv");
|
namePort.putString("error", "timeout");
|
||||||
return namePort;
|
return namePort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,11 @@ public class XmppConnection implements Runnable {
|
|||||||
packetCallbacks.clear();
|
packetCallbacks.clear();
|
||||||
this.changeStatus(Account.STATUS_CONNECTING);
|
this.changeStatus(Account.STATUS_CONNECTING);
|
||||||
Bundle namePort = DNSHelper.getSRVRecord(account.getServer());
|
Bundle namePort = DNSHelper.getSRVRecord(account.getServer());
|
||||||
|
if ("timeout".equals(namePort.getString("error"))) {
|
||||||
|
Log.d(LOGTAG,account.getJid()+": dns timeout");
|
||||||
|
this.changeStatus(Account.STATUS_OFFLINE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
String srvRecordServer = namePort.getString("name");
|
String srvRecordServer = namePort.getString("name");
|
||||||
int srvRecordPort = namePort.getInt("port");
|
int srvRecordPort = namePort.getInt("port");
|
||||||
if (srvRecordServer != null) {
|
if (srvRecordServer != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user