summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-02-11 14:50:37 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-02-15 13:05:18 (GMT)
commit75703db2de5bbfb6622286600362016edb42dfb0 (patch)
tree2520ed777286c6b732e756387ca88d49b9c1814e /Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
parentca226e7bb019308db4bfc818d7e04422d9d28106 (diff)
downloadswift-75703db2de5bbfb6622286600362016edb42dfb0.zip
swift-75703db2de5bbfb6622286600362016edb42dfb0.tar.bz2
Support early IBB use in Jingle File Transfer
Previously Jingle File Transfer in Swiften only used IBB transport as fallback mechanism. With this patch Swiften will use IBB transport candidates directly in the first session-initate/session-accept message if the other party only supports IBB. Fixed a ASAN reported heap-use-after-free in SOCKS5BytestreamServerManager.cpp while testing. Test-Information: ./scons test=system passed without error. Testing all sender/receiver file-transfer option configurations with FileTransferTest resulting in expected behavior. Successfully transferring a file between two Swift instances. Change-Id: Ia0ffeaa1fd54fc0da23db75344c9e94f9d03a774
Diffstat (limited to 'Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h')
-rw-r--r--Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
index 324404d..00a931f 100644
--- a/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
+++ b/Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,19 +9,20 @@
#include <string>
#include <Swiften/Base/API.h>
-#include <Swiften/StringCodecs/Hexify.h>
#include <Swiften/Crypto/CryptoProvider.h>
+#include <Swiften/FileTransfer/FileTransferOptions.h>
#include <Swiften/FileTransfer/FileTransferTransporter.h>
#include <Swiften/FileTransfer/FileTransferTransporterFactory.h>
#include <Swiften/FileTransfer/IBBReceiveSession.h>
#include <Swiften/FileTransfer/IBBReceiveTransportSession.h>
-#include <Swiften/FileTransfer/IBBSendTransportSession.h>
#include <Swiften/FileTransfer/IBBSendSession.h>
+#include <Swiften/FileTransfer/IBBSendTransportSession.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h>
#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>
#include <Swiften/FileTransfer/TransportSession.h>
#include <Swiften/JID/JID.h>
+#include <Swiften/StringCodecs/Hexify.h>
namespace Swift {
@@ -45,7 +46,7 @@ public:
TimerFactory*,
CryptoProvider* cryptoProvider,
IQRouter* iqRouter,
- const FileTransferOptions&) : initiator_(initiator), responder_(responder), role_(role), s5bRegistry_(s5bRegistry), crypto_(cryptoProvider), iqRouter_(iqRouter) {
+ const FileTransferOptions& ftOptions) : initiator_(initiator), responder_(responder), role_(role), s5bRegistry_(s5bRegistry), crypto_(cryptoProvider), iqRouter_(iqRouter), ftOptions_(ftOptions) {
}
@@ -55,6 +56,12 @@ public:
virtual void startGeneratingLocalCandidates() {
std::vector<JingleS5BTransportPayload::Candidate> candidates;
+ if (ftOptions_.isDirectAllowed()) {
+ JingleS5BTransportPayload::Candidate candidate;
+ candidate.cid = "123";
+ candidate.priority = 1235;
+ candidates.push_back(candidate);
+ }
onLocalCandidatesGenerated(s5bSessionID_, candidates, getSOCKS5DstAddr());
}
@@ -139,6 +146,7 @@ private:
CryptoProvider* crypto_;
std::string s5bSessionID_;
IQRouter* iqRouter_;
+ FileTransferOptions ftOptions_;
};
class DummyFileTransferTransporterFactory : public FileTransferTransporterFactory {