diff options
author | Tobias Markmann <tm@ayena.de> | 2015-10-26 14:41:06 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-10-30 14:16:59 (GMT) |
commit | 4a84a2570c5e8f2a282138c74448117ecd0a8939 (patch) | |
tree | 57c5a256c8d040157626828e0488395ec23c7557 | |
parent | 3d62970e1b929cf676202fc6cebc1cf426c14ff2 (diff) | |
download | swift-4a84a2570c5e8f2a282138c74448117ecd0a8939.zip swift-4a84a2570c5e8f2a282138c74448117ecd0a8939.tar.bz2 |
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
-rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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 | |||
@@ -127,32 +127,34 @@ void SOCKS5BytestreamProxiesManager::handleProxiesFound(std::vector<S5BProxyRequ | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
130 | proxyFinder_->stop(); | 130 | proxyFinder_->stop(); |
131 | proxyFinder_.reset(); | 131 | proxyFinder_.reset(); |
132 | if (proxyHosts.empty()) { | ||
133 | onDiscoveredProxiesChanged(); | ||
134 | } | ||
132 | } | 135 | } |
133 | 136 | ||
134 | void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error, S5BProxyRequest::ref proxy) { | 137 | void SOCKS5BytestreamProxiesManager::handleNameLookupResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error, S5BProxyRequest::ref proxy) { |
135 | if (error) { | 138 | if (error) { |
136 | onDiscoveredProxiesChanged(); | 139 | onDiscoveredProxiesChanged(); |
137 | } | 140 | } |
138 | else { | 141 | else { |
139 | if (addresses.empty()) { | 142 | if (addresses.empty()) { |
140 | SWIFT_LOG(warning) << "S5B proxy hostname does not resolve." << std::endl; | 143 | SWIFT_LOG(warning) << "S5B proxy hostname does not resolve." << std::endl; |
141 | onDiscoveredProxiesChanged(); | ||
142 | } | 144 | } |
143 | else { | 145 | else { |
144 | // generate proxy per returned address | 146 | // generate proxy per returned address |
145 | foreach (const HostAddress& address, addresses) { | 147 | foreach (const HostAddress& address, addresses) { |
146 | S5BProxyRequest::StreamHost streamHost = proxy->getStreamHost().get(); | 148 | S5BProxyRequest::StreamHost streamHost = proxy->getStreamHost().get(); |
147 | S5BProxyRequest::ref proxyForAddress = boost::make_shared<S5BProxyRequest>(*proxy); | 149 | S5BProxyRequest::ref proxyForAddress = boost::make_shared<S5BProxyRequest>(*proxy); |
148 | streamHost.host = address.toString(); | 150 | streamHost.host = address.toString(); |
149 | proxyForAddress->setStreamHost(streamHost); | 151 | proxyForAddress->setStreamHost(streamHost); |
150 | addS5BProxy(proxyForAddress); | 152 | addS5BProxy(proxyForAddress); |
151 | } | 153 | } |
152 | onDiscoveredProxiesChanged(); | ||
153 | } | 154 | } |
155 | onDiscoveredProxiesChanged(); | ||
154 | } | 156 | } |
155 | } | 157 | } |
156 | 158 | ||
157 | void SOCKS5BytestreamProxiesManager::queryForProxies() { | 159 | void SOCKS5BytestreamProxiesManager::queryForProxies() { |
158 | proxyFinder_ = boost::make_shared<SOCKS5BytestreamProxyFinder>(serviceRoot_, iqRouter_); | 160 | proxyFinder_ = boost::make_shared<SOCKS5BytestreamProxyFinder>(serviceRoot_, iqRouter_); |