summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-25 14:39:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-05-11 10:22:56 (GMT)
commit927d62cc54c8a5087dba6b61afa9ad30dc528a23 (patch)
treee67dc911bd30c0519d31a542d8e085bbb209879d /Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
parent17b188343e7208b875af7af30d94f0bf948f6b93 (diff)
downloadswift-927d62cc54c8a5087dba6b61afa9ad30dc528a23.zip
swift-927d62cc54c8a5087dba6b61afa9ad30dc528a23.tar.bz2
File Transfer refactoring.
Allocate S5B server lazily. Forward forts lazily. Various state machine fixes. Temporarily disabling S5B proxy support. Change-Id: I3145e85a99b15a7e457306bbfbe9c0eb570191e4
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp50
1 files changed, 8 insertions, 42 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
index 8939579..cf4794c 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp
@@ -11,62 +11,28 @@
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/Log.h>
#include <Swiften/Base/foreach.h>
-#include <Swiften/StringCodecs/Hexify.h>
-#include <Swiften/Crypto/CryptoProvider.h>
namespace Swift {
SOCKS5BytestreamRegistry::SOCKS5BytestreamRegistry() {
}
-void SOCKS5BytestreamRegistry::addReadBytestream(const std::string& destination, boost::shared_ptr<ReadBytestream> byteStream) {
- readBytestreams[destination] = byteStream;
-}
-
-void SOCKS5BytestreamRegistry::removeReadBytestream(const std::string& destination) {
- readBytestreams.erase(destination);
-}
-
-boost::shared_ptr<ReadBytestream> SOCKS5BytestreamRegistry::getReadBytestream(const std::string& destination) const {
- ReadBytestreamMap::const_iterator i = readBytestreams.find(destination);
- if (i != readBytestreams.end()) {
- return i->second;
+void SOCKS5BytestreamRegistry::setHasBytestream(const std::string& destination, bool b) {
+ if (b) {
+ availableBytestreams.insert(destination);
+ }
+ else {
+ availableBytestreams.erase(destination);
}
- return boost::shared_ptr<ReadBytestream>();
-}
-
-void SOCKS5BytestreamRegistry::addWriteBytestream(const std::string& destination, boost::shared_ptr<WriteBytestream> byteStream) {
- writeBytestreams[destination] = byteStream;
-}
-
-void SOCKS5BytestreamRegistry::removeWriteBytestream(const std::string& destination) {
- writeBytestreams.erase(destination);
}
-boost::shared_ptr<WriteBytestream> SOCKS5BytestreamRegistry::getWriteBytestream(const std::string& destination) const {
- WriteBytestreamMap::const_iterator i = writeBytestreams.find(destination);
- if (i != writeBytestreams.end()) {
- return i->second;
- }
- return boost::shared_ptr<WriteBytestream>();
+bool SOCKS5BytestreamRegistry::hasBytestream(const std::string& destination) const {
+ return availableBytestreams.find(destination) != availableBytestreams.end();
}
std::string SOCKS5BytestreamRegistry::generateSessionID() {
return idGenerator.generateID();
}
-SOCKS5BytestreamServerSession* SOCKS5BytestreamRegistry::getConnectedSession(const std::string& destination) {
- if (serverSessions.find(destination) != serverSessions.end()) {
- return serverSessions[destination];
- } else {
- SWIFT_LOG(debug) << "No active connction for stream ID " << destination << " found!" << std::endl;
- return NULL;
- }
-}
-
-std::string SOCKS5BytestreamRegistry::getHostname(const std::string& sessionID, const JID& requester, const JID& target, CryptoProvider* crypto) {
- return Hexify::hexify(crypto->getSHA1Hash(createSafeByteArray(sessionID + requester.toString() + target.toString())));
-}
-
}