From 4a84a2570c5e8f2a282138c74448117ecd0a8939 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 26 Oct 2015 15:41:06 +0100
Subject: Fix bug in FT candidate discovery in absence of S5B proxies

With this commit
SOCKS5BytestreamProxiesManager::onDiscoveredProxiesChanged
will be emitted even if no proxies are found.

Move signal emission out of if/else scopes as it was present
in both cases.

Test-Information:

Tested file-transfer with the sender located at a server
without a S5B proxy.

Change-Id: Ic79928e539a6f39f23bfda370d701bf6d9ca9cbf

diff --git a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
index 3221790..a1ef8f6 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp
@@ -129,6 +129,9 @@ void SOCKS5BytestreamProxiesManager::handleProxiesFound(std::vector<S5BProxyRequ
 	}
 	proxyFinder_->stop();
 	proxyFinder_.reset();
+	if (proxyHosts.empty()) {
+		onDiscoveredProxiesChanged();
+	}
 }
 
 void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error, S5BProxyRequest::ref proxy) {
@@ -138,7 +141,6 @@ void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<Ho
 	else {
 		if (addresses.empty()) {
 			SWIFT_LOG(warning) << "S5B proxy hostname does not resolve." << std::endl;
-			onDiscoveredProxiesChanged();
 		}
 		else {
 			// generate proxy per returned address
@@ -149,8 +151,8 @@ void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<Ho
 				proxyForAddress->setStreamHost(streamHost);
 				addS5BProxy(proxyForAddress);
 			}
-			onDiscoveredProxiesChanged();
 		}
+		onDiscoveredProxiesChanged();
 	}
 }
 
-- 
cgit v0.10.2-6-g49f6