diff options
Diffstat (limited to 'Swiften/FileTransfer/JingleFileTransfer.cpp')
-rw-r--r-- | Swiften/FileTransfer/JingleFileTransfer.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp index e2c0f3a..dbc4391 100644 --- a/Swiften/FileTransfer/JingleFileTransfer.cpp +++ b/Swiften/FileTransfer/JingleFileTransfer.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/FileTransfer/JingleFileTransfer.h> @@ -109,32 +109,38 @@ void JingleFileTransfer::decideOnCandidates() { } if (!ourCandidateChoice && !theirCandidateChoice) { SWIFT_LOG(debug) << "No candidates succeeded." << std::endl; fallback(); } else if (ourCandidateChoice && !theirCandidateChoice) { + SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << "." << std::endl; startTransferViaRemoteCandidate(); } else if (theirCandidateChoice && !ourCandidateChoice) { + SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid << "." << std::endl; startTransferViaLocalCandidate(); } else { SWIFT_LOG(debug) << "Choosing between candidates " << ourCandidateChoice->cid << "(" << ourCandidateChoice->priority << ")" << " and " << theirCandidateChoice->cid << "(" << theirCandidateChoice->priority << ")" << std::endl; if (ourCandidateChoice->priority > theirCandidateChoice->priority) { + SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << "." << std::endl; startTransferViaRemoteCandidate(); } else if (ourCandidateChoice->priority < theirCandidateChoice->priority) { + SWIFT_LOG(debug) << "Start transfer using local candidate:" << theirCandidateChoice.get().cid << "." << std::endl; startTransferViaLocalCandidate(); } else { if (hasPriorityOnCandidateTie()) { + SWIFT_LOG(debug) << "Start transfer using remote candidate: " << ourCandidateChoice.get().cid << std::endl; startTransferViaRemoteCandidate(); } else { + SWIFT_LOG(debug) << "Start transfer using local candidate: " << theirCandidateChoice.get().cid << std::endl; startTransferViaLocalCandidate(); } } } } @@ -153,13 +159,13 @@ void JingleFileTransfer::handleProxyActivateFinished( } else { JingleS5BTransportPayload::ref proxyActivate = boost::make_shared<JingleS5BTransportPayload>(); proxyActivate->setSessionID(s5bSessionID); proxyActivate->setActivated(theirCandidateChoice->cid); session->sendTransportInfo(getContentID(), proxyActivate); - startTransferring(createRemoteCandidateSession()); + startTransferring(createLocalCandidateSession()); } } void JingleFileTransfer::handleTransportInfoReceived( const JingleContentID& /* contentID */, JingleTransportPayload::ref transport) { SWIFT_LOG(debug) << std::endl; @@ -190,25 +196,29 @@ void JingleFileTransfer::handleTransportInfoReceived( } else { SWIFT_LOG(warning) << "ourCandidateChoice doesn't match activated proxy candidate!" << std::endl; terminate(JinglePayload::Reason::GeneralError); } } + else if (s5bPayload->hasProxyError()) { + SWIFT_LOG(debug) << "Received proxy error. Trying to fall back to IBB." << std::endl; + fallback(); + } else { SWIFT_LOG(debug) << "Ignoring unknown info" << std::endl; } } else { SWIFT_LOG(debug) << "Ignoring unknown info" << std::endl; } } void JingleFileTransfer::setTransporter(FileTransferTransporter* transporter) { this->transporter = transporter; localTransportCandidatesGeneratedConnection = transporter->onLocalCandidatesGenerated.connect( - boost::bind(&JingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1, _2)); + boost::bind(&JingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1, _2, _3)); remoteTransportCandidateSelectFinishedConnection = transporter->onRemoteCandidateSelectFinished.connect( boost::bind(&JingleFileTransfer::handleRemoteTransportCandidateSelectFinished, this, _1, _2)); proxyActivatedConnection = transporter->onProxyActivated.connect( boost::bind(&JingleFileTransfer::handleProxyActivateFinished, this, _1, _2)); } |