summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-01-11 17:13:41 (GMT)
committerSwift Review <review@swift.im>2015-02-11 09:36:14 (GMT)
commita049c80f0862a994a76e8e63d71c633bce63f66a (patch)
treec5fc7786d2d245c765067545bb9a0e433e58a3f9 /Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
parentf176050a50fb846bbad3fb49d6b2f7a2c81e3589 (diff)
downloadswift-a049c80f0862a994a76e8e63d71c633bce63f66a.zip
swift-a049c80f0862a994a76e8e63d71c633bce63f66a.tar.bz2
Renable SOCKS5 bytestream proxy support for Jingle file transfers.
Test-Information: Tested interoperability with Swiften using FileTransferTest. Change-Id: Ic13a68a91cad199be0bfc8852ff43c25c7085f12
Diffstat (limited to 'Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp')
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
index 07e927e..7ff1a08 100644
--- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
+++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp
@@ -111,7 +111,7 @@ void OutgoingJingleFileTransfer::handleSessionAcceptReceived(
if (state != WaitingForAccept) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; }
if (JingleS5BTransportPayload::ref s5bPayload = boost::dynamic_pointer_cast<JingleS5BTransportPayload>(transportPayload)) {
- transporter->addRemoteCandidates(s5bPayload->getCandidates());
+ transporter->addRemoteCandidates(s5bPayload->getCandidates(), s5bPayload->getDstAddr());
setState(TryingCandidates);
transporter->startTryingRemoteCandidates();
}
@@ -123,7 +123,7 @@ void OutgoingJingleFileTransfer::handleSessionAcceptReceived(
void OutgoingJingleFileTransfer::handleSessionTerminateReceived(boost::optional<JinglePayload::Reason> reason) {
SWIFT_LOG(debug) << std::endl;
- if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; }
+ if (state == Finished) { SWIFT_LOG(warning) << "Incorrect state: " << state << std::endl; return; }
stopAll();
if (reason && reason->type == JinglePayload::Reason::Cancel) {
@@ -150,6 +150,12 @@ void OutgoingJingleFileTransfer::handleTransportAcceptReceived(const JingleConte
}
}
+void OutgoingJingleFileTransfer::handleTransportRejectReceived(const JingleContentID &, boost::shared_ptr<JingleTransportPayload>) {
+ SWIFT_LOG(debug) << std::endl;
+
+ terminate(JinglePayload::Reason::UnsupportedTransports);
+}
+
void OutgoingJingleFileTransfer::sendSessionInfoHash() {
SWIFT_LOG(debug) << std::endl;
@@ -160,7 +166,7 @@ void OutgoingJingleFileTransfer::sendSessionInfoHash() {
}
void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
- const std::string& s5bSessionID, const std::vector<JingleS5BTransportPayload::Candidate>& candidates) {
+ const std::string& s5bSessionID, 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; }
@@ -174,6 +180,7 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
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);
}
@@ -182,8 +189,8 @@ void OutgoingJingleFileTransfer::handleLocalTransportCandidatesGenerated(
}
void OutgoingJingleFileTransfer::fallback() {
- SWIFT_LOG(debug) << std::endl;
if (options.isInBandAllowed()) {
+ SWIFT_LOG(debug) << "Trying to fallback to IBB transport." << std::endl;
JingleIBBTransportPayload::ref ibbTransport = boost::make_shared<JingleIBBTransportPayload>();
ibbTransport->setBlockSize(DEFAULT_BLOCK_SIZE);
ibbTransport->setSessionID(idGenerator->generateID());
@@ -191,13 +198,14 @@ void OutgoingJingleFileTransfer::fallback() {
session->sendTransportReplace(contentID, ibbTransport);
}
else {
+ SWIFT_LOG(debug) << "Fallback to IBB transport not allowed." << std::endl;
terminate(JinglePayload::Reason::ConnectivityError);
}
}
void OutgoingJingleFileTransfer::handleTransferFinished(boost::optional<FileTransferError> error) {
SWIFT_LOG(debug) << std::endl;
- if (state != Transferring) { SWIFT_LOG(warning) << "Incorrect state" << std::endl; return; }
+ if (state != Transferring) { SWIFT_LOG(warning) << "Incorrect state: " << state << std::endl; return; }
if (error) {
terminate(JinglePayload::Reason::ConnectivityError);
@@ -347,11 +355,11 @@ bool OutgoingJingleFileTransfer::isTryingCandidates() const {
}
boost::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createLocalCandidateSession() {
- return transporter->createLocalCandidateSession(stream);
+ return transporter->createLocalCandidateSession(stream, theirCandidateChoice.get());
}
boost::shared_ptr<TransportSession> OutgoingJingleFileTransfer::createRemoteCandidateSession() {
- return transporter->createRemoteCandidateSession(stream);
+ return transporter->createRemoteCandidateSession(stream, ourCandidateChoice.get());
}
void OutgoingJingleFileTransfer::handleWaitForRemoteTerminationTimeout() {