diff options
Diffstat (limited to 'Swiften/FileTransfer/IncomingJingleFileTransfer.cpp')
-rw-r--r-- | Swiften/FileTransfer/IncomingJingleFileTransfer.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp index daecf92..a0cd47c 100644 --- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp +++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp @@ -77,13 +77,13 @@ void IncomingJingleFileTransfer::accept( boost::bind(&IncomingJingleFileTransfer::handleWriteStreamDataReceived, this, _1)); if (JingleS5BTransportPayload::ref s5bTransport = initialContent->getTransport<JingleS5BTransportPayload>()) { SWIFT_LOG(debug) << "Got S5B transport as initial payload." << std::endl; setTransporter(transporterFactory->createResponderTransporter( getInitiator(), getResponder(), s5bTransport->getSessionID(), options)); - transporter->addRemoteCandidates(s5bTransport->getCandidates()); + transporter->addRemoteCandidates(s5bTransport->getCandidates(), s5bTransport->getDstAddr()); setState(GeneratingInitialLocalCandidates); transporter->startGeneratingLocalCandidates(); } else if (JingleIBBTransportPayload::ref ibbTransport = initialContent->getTransport<JingleIBBTransportPayload>()) { SWIFT_LOG(debug) << "Got IBB transport as initial payload." << std::endl; setTransporter(transporterFactory->createResponderTransporter( @@ -106,21 +106,23 @@ void IncomingJingleFileTransfer::cancel() { SWIFT_LOG(debug) << std::endl; terminate(state == Initial ? JinglePayload::Reason::Decline : JinglePayload::Reason::Cancel); } void IncomingJingleFileTransfer::handleLocalTransportCandidatesGenerated( const std::string& s5bSessionID, - const std::vector<JingleS5BTransportPayload::Candidate>& candidates) { + const std::vector<JingleS5BTransportPayload::Candidate>& candidates, + const std::string& dstAddr) { SWIFT_LOG(debug) << std::endl; if (state != GeneratingInitialLocalCandidates) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } fillCandidateMap(localCandidates, candidates); JingleS5BTransportPayload::ref transport = boost::make_shared<JingleS5BTransportPayload>(); transport->setSessionID(s5bSessionID); transport->setMode(JingleS5BTransportPayload::TCPMode); + transport->setDstAddr(dstAddr); foreach(JingleS5BTransportPayload::Candidate candidate, candidates) { transport->addCandidate(candidate); } session->sendAccept(getContentID(), initialContent->getDescriptions()[0], transport); setState(TryingCandidates); @@ -216,13 +218,14 @@ void IncomingJingleFileTransfer::handleTransportReplaceReceived( SWIFT_LOG(debug) << std::endl; if (state != WaitingForFallbackOrTerminate) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; } - if (JingleIBBTransportPayload::ref ibbTransport = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transport)) { + JingleIBBTransportPayload::ref ibbTransport; + if (options.isInBandAllowed() && (ibbTransport = boost::dynamic_pointer_cast<JingleIBBTransportPayload>(transport))) { SWIFT_LOG(debug) << "transport replaced with IBB" << std::endl; startTransferring(transporter->createIBBReceiveSession( ibbTransport->getSessionID(), description->getFileInfo().getSize(), stream)); @@ -335,18 +338,13 @@ void IncomingJingleFileTransfer::stopAll() { bool IncomingJingleFileTransfer::hasPriorityOnCandidateTie() const { return false; } void IncomingJingleFileTransfer::fallback() { - if (options.isInBandAllowed()) { - setState(WaitingForFallbackOrTerminate); - } - else { - terminate(JinglePayload::Reason::ConnectivityError); - } + setState(WaitingForFallbackOrTerminate); } void IncomingJingleFileTransfer::startTransferViaRemoteCandidate() { SWIFT_LOG(debug) << std::endl; if (ourCandidateChoice->type == JingleS5BTransportPayload::Candidate::ProxyType) { @@ -366,13 +364,12 @@ void IncomingJingleFileTransfer::startTransferViaLocalCandidate() { } else { startTransferring(createLocalCandidateSession()); } } - void IncomingJingleFileTransfer::startTransferring(boost::shared_ptr<TransportSession> transportSession) { SWIFT_LOG(debug) << std::endl; this->transportSession = transportSession; transferFinishedConnection = transportSession->onFinished.connect( boost::bind(&IncomingJingleFileTransfer::handleTransferFinished, this, _1)); @@ -390,17 +387,17 @@ bool IncomingJingleFileTransfer::isWaitingForLocalProxyActivate() const { bool IncomingJingleFileTransfer::isTryingCandidates() const { return state == TryingCandidates; } boost::shared_ptr<TransportSession> IncomingJingleFileTransfer::createLocalCandidateSession() { - return transporter->createLocalCandidateSession(stream); + return transporter->createLocalCandidateSession(stream, theirCandidateChoice.get()); } boost::shared_ptr<TransportSession> IncomingJingleFileTransfer::createRemoteCandidateSession() { - return transporter->createRemoteCandidateSession(stream); + return transporter->createRemoteCandidateSession(stream, ourCandidateChoice.get()); } void IncomingJingleFileTransfer::terminate(JinglePayload::Reason::Type reason) { SWIFT_LOG(debug) << reason << std::endl; if (state != Finished) { |