summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/client/CoreClient.java3
-rw-r--r--src/com/isode/stroke/network/Connector.java16
2 files changed, 10 insertions, 9 deletions
diff --git a/src/com/isode/stroke/client/CoreClient.java b/src/com/isode/stroke/client/CoreClient.java
index 524a05a..646f8fe 100644
--- a/src/com/isode/stroke/client/CoreClient.java
+++ b/src/com/isode/stroke/client/CoreClient.java
@@ -187,7 +187,8 @@ public class CoreClient {
/* FIXME: Port Proxies */
String host = (o.manualHostname == null || o.manualHostname.isEmpty()) ? jid_.getDomain() : o.manualHostname;
int port = o.manualPort;
- connector_ = Connector.create(host, port, o.manualHostname == null || o.manualHostname.isEmpty(), networkFactories.getDomainNameResolver(), networkFactories.getConnectionFactory(), networkFactories.getTimerFactory());
+ String serviceLookupPrefix = (o.manualHostname == null || o.manualHostname.isEmpty() ? "_xmpp-client._tcp." : null);
+ connector_ = Connector.create(host, port, serviceLookupPrefix, networkFactories.getDomainNameResolver(), networkFactories.getConnectionFactory(), networkFactories.getTimerFactory());
connectorConnectFinishedConnection_ = connector_.onConnectFinished.connect(new Slot2<Connection, com.isode.stroke.base.Error>() {
public void call(Connection p1, com.isode.stroke.base.Error p2) {
handleConnectorFinished(p1, p2);
diff --git a/src/com/isode/stroke/network/Connector.java b/src/com/isode/stroke/network/Connector.java
index 983882b..80caf0e 100644
--- a/src/com/isode/stroke/network/Connector.java
+++ b/src/com/isode/stroke/network/Connector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2012, Isode Limited, London, England.
+ * Copyright (c) 2010-2014, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -20,8 +20,8 @@ import java.util.Collection;
public class Connector {
- public static Connector create(String hostname, int port, boolean doServiceLookups, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) {
- return new Connector(hostname, port, doServiceLookups, resolver, connectionFactory, timerFactory);
+ public static Connector create(String hostname, int port, String serviceLookupPrefix, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) {
+ return new Connector(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory);
}
public void setTimeoutMilliseconds(int milliseconds) {
@@ -35,8 +35,8 @@ public class Connector {
queriedAllServices = false;
serviceQueryResults = new ArrayList<Result>();
- if (doServiceLookups) {
- serviceQuery = resolver.createServiceQuery("_xmpp-client._tcp." + hostname);
+ if (serviceLookupPrefix != null) {
+ serviceQuery = resolver.createServiceQuery(serviceLookupPrefix + hostname);
serviceQuery.onResult.connect(new Slot1<Collection<DomainNameServiceQuery.Result>>() {
public void call(Collection<Result> p1) {
handleServiceQueryResult(p1);
@@ -64,13 +64,13 @@ public class Connector {
public final Signal2<Connection, com.isode.stroke.base.Error> onConnectFinished = new Signal2<Connection, com.isode.stroke.base.Error>();
- private Connector(String hostname,int port, boolean doServiceLookups, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) {
+ private Connector(String hostname,int port, String serviceLookupPrefix, DomainNameResolver resolver, ConnectionFactory connectionFactory, TimerFactory timerFactory) {
this.hostname = hostname;
this.resolver = resolver;
this.connectionFactory = connectionFactory;
this.timerFactory = timerFactory;
this.port = port;
- this.doServiceLookups = doServiceLookups;
+ this.serviceLookupPrefix = serviceLookupPrefix;
}
private void handleServiceQueryResult(Collection<Result> result) {
@@ -231,6 +231,6 @@ public class Connector {
private Connection currentConnection;
private SignalConnection currentConnectionConnectFinishedConnection;
private final int port;
- private final boolean doServiceLookups;
+ private final String serviceLookupPrefix;
private boolean foundSomeDNS = false;
}