From d949d1638c0778a6262c3afa13b55059a85b0499 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 23 Jun 2014 16:52:23 +0100
Subject: Apply a Connector timeout even if not using SRV lookups.

Test-Information:
Unit tests only

Change-Id: I7bc7d48a041f33b1a8527b5be4a476c12f796b34

diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index a58efbc..da2490f 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -31,13 +31,13 @@ void Connector::start() {
 	assert(!serviceQuery);
 	assert(!timer);
 	queriedAllServices = false;
+	if (timeoutMilliseconds > 0) {
+		timer = timerFactory->createTimer(timeoutMilliseconds);
+		timer->onTick.connect(boost::bind(&Connector::handleTimeout, shared_from_this()));
+	}
 	if (serviceLookupPrefix) {
 		serviceQuery = resolver->createServiceQuery((*serviceLookupPrefix) + hostname);
 		serviceQuery->onResult.connect(boost::bind(&Connector::handleServiceQueryResult, shared_from_this(), _1));
-		if (timeoutMilliseconds > 0) {
-			timer = timerFactory->createTimer(timeoutMilliseconds);
-			timer->onTick.connect(boost::bind(&Connector::handleTimeout, shared_from_this()));
-		}
 		serviceQuery->run();
 	}
 	else {
-- 
cgit v0.10.2-6-g49f6