diff options
Diffstat (limited to 'Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp')
-rw-r--r-- | Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp index 1f563e3..05a0f0e 100644 --- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp +++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h> @@ -23,15 +23,17 @@ #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> using namespace Swift; RemoteJingleTransportCandidateSelector::RemoteJingleTransportCandidateSelector( ConnectionFactory* connectionFactory, - TimerFactory* timerFactory) : + TimerFactory* timerFactory, + const FileTransferOptions& options) : connectionFactory(connectionFactory), - timerFactory(timerFactory) { + timerFactory(timerFactory), + options(options) { } RemoteJingleTransportCandidateSelector::~RemoteJingleTransportCandidateSelector() { } void RemoteJingleTransportCandidateSelector::addCandidates( @@ -59,15 +61,15 @@ void RemoteJingleTransportCandidateSelector::tryNextCandidate() { boost::optional<JingleS5BTransportPayload::Candidate>(), boost::shared_ptr<SOCKS5BytestreamClientSession>()); } else { lastCandidate = candidates.top(); candidates.pop(); SWIFT_LOG(debug) << "Trying candidate " << lastCandidate.cid << std::endl; - if (lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType - || lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType - || lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType ) { + if ((lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType && options.isDirectAllowed()) || + (lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType && options.isAssistedAllowed()) || + (lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType && options.isProxiedAllowed())) { boost::shared_ptr<Connection> connection = connectionFactory->createConnection(); s5bSession = boost::make_shared<SOCKS5BytestreamClientSession>( connection, lastCandidate.hostPort, socks5DstAddr, timerFactory); sessionReadyConnection = s5bSession->onSessionReady.connect( boost::bind(&RemoteJingleTransportCandidateSelector::handleSessionReady, this, _1)); s5bSession->start(); |