diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-23 07:09:39 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-23 11:30:02 (GMT) |
commit | e405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch) | |
tree | 9118ef838ebfaec1df90ec24761944b5d833774c /Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp | |
parent | 8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff) | |
download | swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2 |
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information:
Build on macOS 10.12.1 and all tests pass.
Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp')
-rw-r--r-- | Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp index a0e7a6f..56013ca 100644 --- a/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp +++ b/Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp @@ -1,72 +1,71 @@ /* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h> #include <memory> #include <boost/bind.hpp> #include <boost/signals2.hpp> #include <Swiften/Base/Log.h> -#include <Swiften/Base/foreach.h> #include <Swiften/Elements/JingleS5BTransportPayload.h> #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> #include <Swiften/Network/ConnectionFactory.h> using namespace Swift; RemoteJingleTransportCandidateSelector::RemoteJingleTransportCandidateSelector( ConnectionFactory* connectionFactory, TimerFactory* timerFactory, const FileTransferOptions& options) : connectionFactory(connectionFactory), timerFactory(timerFactory), options(options) { } RemoteJingleTransportCandidateSelector::~RemoteJingleTransportCandidateSelector() { } void RemoteJingleTransportCandidateSelector::addCandidates( const std::vector<JingleS5BTransportPayload::Candidate>& candidates) { - foreach(JingleS5BTransportPayload::Candidate c, candidates) { + for (auto&& c : candidates) { this->candidates.push(c); } } void RemoteJingleTransportCandidateSelector::startSelectingCandidate() { tryNextCandidate(); } void RemoteJingleTransportCandidateSelector::stopSelectingCandidate() { if (s5bSession) { sessionReadyConnection.disconnect(); s5bSession->stop(); } } void RemoteJingleTransportCandidateSelector::tryNextCandidate() { if (candidates.empty()) { SWIFT_LOG(debug) << "No more candidates" << std::endl; onCandidateSelectFinished( boost::optional<JingleS5BTransportPayload::Candidate>(), std::shared_ptr<SOCKS5BytestreamClientSession>()); } else { lastCandidate = candidates.top(); candidates.pop(); SWIFT_LOG(debug) << "Trying candidate " << lastCandidate.cid << std::endl; if ((lastCandidate.type == JingleS5BTransportPayload::Candidate::DirectType && options.isDirectAllowed()) || (lastCandidate.type == JingleS5BTransportPayload::Candidate::AssistedType && options.isAssistedAllowed()) || (lastCandidate.type == JingleS5BTransportPayload::Candidate::ProxyType && options.isProxiedAllowed())) { std::shared_ptr<Connection> connection = connectionFactory->createConnection(); s5bSession = std::make_shared<SOCKS5BytestreamClientSession>( |