mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 15:32:06 +01:00
Always lookup DNS SRV RR on connect()
This commit is contained in:
parent
363354f237
commit
1cf4681581
2 changed files with 13 additions and 13 deletions
|
@ -113,9 +113,16 @@ public class BOSHConfiguration extends ConnectionConfiguration {
|
||||||
if (file.charAt(0) != '/') {
|
if (file.charAt(0) != '/') {
|
||||||
file = '/' + file;
|
file = '/' + file;
|
||||||
}
|
}
|
||||||
|
String host;
|
||||||
|
int port;
|
||||||
|
if (hostAddresses != null) {
|
||||||
HostAddress hostAddress = hostAddresses.get(0);
|
HostAddress hostAddress = hostAddresses.get(0);
|
||||||
String host = hostAddress.getFQDN();
|
host = hostAddress.getFQDN();
|
||||||
int port = hostAddress.getPort();
|
port = hostAddress.getPort();
|
||||||
|
} else {
|
||||||
|
host = getServiceName();
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
return new URI((ssl ? "https://" : "http://") + host + ":" + port + file);
|
return new URI((ssl ? "https://" : "http://") + host + ":" + port + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class ConnectionConfiguration implements Cloneable {
|
||||||
private boolean sendPresence = true;
|
private boolean sendPresence = true;
|
||||||
private boolean rosterLoadedAtLogin = true;
|
private boolean rosterLoadedAtLogin = true;
|
||||||
private boolean legacySessionDisabled = false;
|
private boolean legacySessionDisabled = false;
|
||||||
|
private boolean useDnsSrvRr = true;
|
||||||
private SecurityMode securityMode = SecurityMode.enabled;
|
private SecurityMode securityMode = SecurityMode.enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,13 +88,6 @@ public class ConnectionConfiguration implements Cloneable {
|
||||||
// Holds the proxy information (such as proxyhost, proxyport, username, password etc)
|
// Holds the proxy information (such as proxyhost, proxyport, username, password etc)
|
||||||
protected ProxyInfo proxy;
|
protected ProxyInfo proxy;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used for subclassing ConnectionConfiguration
|
|
||||||
*/
|
|
||||||
ConnectionConfiguration() {
|
|
||||||
/* Does nothing */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new ConnectionConfiguration for the specified service name.
|
* Creates a new ConnectionConfiguration for the specified service name.
|
||||||
* A DNS SRV lookup will be performed to find out the actual host address
|
* A DNS SRV lookup will be performed to find out the actual host address
|
||||||
|
@ -566,9 +560,7 @@ public class ConnectionConfiguration implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void maybeResolveDns() throws Exception {
|
void maybeResolveDns() throws Exception {
|
||||||
// Abort if we did already resolve the hosts successfully
|
if (!useDnsSrvRr) return;
|
||||||
if (hostAddresses != null)
|
|
||||||
return;
|
|
||||||
hostAddresses = DNSUtil.resolveXMPPDomain(serviceName);
|
hostAddresses = DNSUtil.resolveXMPPDomain(serviceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,5 +569,6 @@ public class ConnectionConfiguration implements Cloneable {
|
||||||
HostAddress hostAddress;
|
HostAddress hostAddress;
|
||||||
hostAddress = new HostAddress(host, port);
|
hostAddress = new HostAddress(host, port);
|
||||||
hostAddresses.add(hostAddress);
|
hostAddresses.add(hostAddress);
|
||||||
|
useDnsSrvRr = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue