diff options
author | Tobias Markmann <tm@ayena.de> | 2015-01-11 12:39:50 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-02-11 09:35:33 (GMT) |
commit | 9281a35fb912657f98ff0918ed683b2ef6071b45 (patch) | |
tree | 9a9ac8a5e9cf9f2d3680fbc2323e643f03bfe5d8 /Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp | |
parent | 779f0d57bc9d90300aad0b1386dc937612ac35f4 (diff) | |
download | swift-9281a35fb912657f98ff0918ed683b2ef6071b45.zip swift-9281a35fb912657f98ff0918ed683b2ef6071b45.tar.bz2 |
Restrict generated candidates and selected candidates to those allowed
by supplied FileTransferOptions.
Test-Information:
Automatically tested all FileTransferOption combinations and verified
it generates only allowed candidates.
Change-Id: I0b3ce983a3f230a4c2c3940f5d928fd74d6012b6
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 @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,9 +26,11 @@ using namespace Swift; RemoteJingleTransportCandidateSelector::RemoteJingleTransportCandidateSelector( ConnectionFactory* connectionFactory, - TimerFactory* timerFactory) : + TimerFactory* timerFactory, + const FileTransferOptions& options) : connectionFactory(connectionFactory), - timerFactory(timerFactory) { + timerFactory(timerFactory), + options(options) { } RemoteJingleTransportCandidateSelector::~RemoteJingleTransportCandidateSelector() { @@ -62,9 +64,9 @@ void RemoteJingleTransportCandidateSelector::tryNextCandidate() { 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); |