summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorNick Hudson <nick.hudson@isode.com>2014-07-14 10:26:04 (GMT)
committerSwift Review <review@swift.im>2014-07-24 08:41:25 (GMT)
commite21b855abf977fd0acdf6173db82f805e512f347 (patch)
tree848681c86494d7a0a3d29a57a224130fe8cf68e8 /src/com
parentf86f1c1df0fc8bfd72306d55d370e202378652b2 (diff)
downloadstroke-e21b855abf977fd0acdf6173db82f805e512f347.zip
stroke-e21b855abf977fd0acdf6173db82f805e512f347.tar.bz2
Apply a Connector timeout even if not using SRV lookups
Corresponds to the Swiften change of the same name, d949d1638c Test-information: Unit tests pass. Verified that the new code works as expected in a test application that previously would never see timeouts. Change-Id: I95cc73a81e42d6ac00c79f74531e8dd6c67882f3
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/network/Connector.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/com/isode/stroke/network/Connector.java b/src/com/isode/stroke/network/Connector.java
index 80caf0e..13a2bc3 100644
--- a/src/com/isode/stroke/network/Connector.java
+++ b/src/com/isode/stroke/network/Connector.java
@@ -9,7 +9,6 @@
package com.isode.stroke.network;
import com.isode.stroke.network.DomainNameServiceQuery.Result;
-import com.isode.stroke.signals.Signal1;
import com.isode.stroke.signals.Signal2;
import com.isode.stroke.signals.SignalConnection;
import com.isode.stroke.signals.Slot;
@@ -35,6 +34,15 @@ public class Connector {
queriedAllServices = false;
serviceQueryResults = new ArrayList<Result>();
+ if (timeoutMilliseconds > 0) {
+ timer = timerFactory.createTimer(timeoutMilliseconds);
+ timer.onTick.connect(new Slot() {
+ public void call() {
+ handleTimeout();
+ }
+ });
+ timer.start();
+ }
if (serviceLookupPrefix != null) {
serviceQuery = resolver.createServiceQuery(serviceLookupPrefix + hostname);
serviceQuery.onResult.connect(new Slot1<Collection<DomainNameServiceQuery.Result>>() {
@@ -42,15 +50,6 @@ public class Connector {
handleServiceQueryResult(p1);
}
});
- if (timeoutMilliseconds > 0) {
- timer = timerFactory.createTimer(timeoutMilliseconds);
- timer.onTick.connect(new Slot() {
- public void call() {
- handleTimeout();
- }
- });
- timer.start();
- }
serviceQuery.run();
}
else {