[swift] Added missing patches
Jan Kaluža
jkaluza at fedoraproject.org
Wed Aug 1 08:10:13 UTC 2012
commit 04faa0b5d13a28770c995a210eaa2d78dd4abd66
Author: Jan Kaluza <hanzz.k at gmail.com>
Date: Wed Aug 1 10:08:47 2012 +0200
Added missing patches
swift-no-cache-jid-prep.patch | 14 ++++++
swiften-libdirsuffix.patch | 30 +++++++++++++
swiften-socks5.patch | 91 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 135 insertions(+), 0 deletions(-)
---
diff --git a/swift-no-cache-jid-prep.patch b/swift-no-cache-jid-prep.patch
new file mode 100644
index 0000000..43957ef
--- /dev/null
+++ b/swift-no-cache-jid-prep.patch
@@ -0,0 +1,14 @@
+diff --git a/Swiften/JID/JID.cpp b/Swiften/JID/JID.cpp
+index 66d6ff6..25b6534 100644
+--- a/Swiften/JID/JID.cpp
++++ b/Swiften/JID/JID.cpp
+@@ -4,7 +4,7 @@
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+-#define SWIFTEN_CACHE_JID_PREP
++//#define SWIFTEN_CACHE_JID_PREP
+
+ #include <vector>
+ #include <list>
+
diff --git a/swiften-libdirsuffix.patch b/swiften-libdirsuffix.patch
new file mode 100644
index 0000000..0dc2af0
--- /dev/null
+++ b/swiften-libdirsuffix.patch
@@ -0,0 +1,30 @@
+diff --git a/Swiften/SConscript b/Swiften/SConscript
+index 379576d..7096a9c 100644
+--- a/Swiften/SConscript
++++ b/Swiften/SConscript
+@@ -425,8 +425,11 @@ if env["SCONS_STAGE"] == "build" :
+
+ # Install swiften
+ if swiften_env.get("SWIFTEN_INSTALLDIR", "") :
+- swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib"), swiften_lib)
++ libdir = os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib")
++ if swiften_env.get("SWIFTEN_LIBDIR", "") :
++ libdir = swiften_env["SWIFTEN_LIBDIR"]
++ swiften_env.Install(libdir, swiften_lib)
+ for alias in myenv["SWIFTEN_LIBRARY_ALIASES"] :
+- myenv.Command(myenv.File(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "lib", alias)), [env.Value(swiften_lib[0].name), swiften_lib[0]], symlink)
++ myenv.Command(myenv.File(os.path.join(libdir, alias)), [env.Value(swiften_lib[0].name), swiften_lib[0]], symlink)
+ for include in swiften_includes :
+ swiften_env.Install(os.path.join(swiften_env["SWIFTEN_INSTALLDIR"], "include", os.path.dirname(include)), "#/" + include)
+
+--- a/BuildTools/SCons/SConscript.boot
++++ b/BuildTools/SCons/SConscript.boot
+@@ -220,7 +220,7 @@ env["TEST_CREATE_LIBRARIES"] = "create_test_libraries" in ARGUMENTS
+
+ # Packaging
+ env["DIST"] = "dist" in ARGUMENTS or env.GetOption("clean")
+-for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR"] :
++for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR", "SWIFTEN_LIBDIR"] :
+ if ARGUMENTS.get(path, "") :
+ if os.path.isabs(ARGUMENTS[path]) :
+ env[path] = Dir(ARGUMENTS[path]).abspath
diff --git a/swiften-socks5.patch b/swiften-socks5.patch
new file mode 100644
index 0000000..bd953d2
--- /dev/null
+++ b/swiften-socks5.patch
@@ -0,0 +1,91 @@
+diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+index f660fda..227c755 100644
+--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
++++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+@@ -19,7 +19,7 @@
+
+ namespace Swift {
+
+-SOCKS5BytestreamServerSession::SOCKS5BytestreamServerSession(boost::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* bytestreams) : connection(connection), bytestreams(bytestreams), state(Initial), chunkSize(131072) {
++SOCKS5BytestreamServerSession::SOCKS5BytestreamServerSession(boost::shared_ptr<Connection> connection, SOCKS5BytestreamRegistry* bytestreams) : connection(connection), bytestreams(bytestreams), state(Initial), chunkSize(131072), waitingForData(false) {
+ connection->onDisconnected.connect(boost::bind(&SOCKS5BytestreamServerSession::handleDisconnected, this, _1));
+ }
+
+@@ -40,10 +40,14 @@ void SOCKS5BytestreamServerSession::stop() {
+ connection->onDataWritten.disconnect(boost::bind(&SOCKS5BytestreamServerSession::sendData, this));
+ connection->onDataRead.disconnect(boost::bind(&SOCKS5BytestreamServerSession::handleDataRead, this, _1));
+ connection->disconnect();
++ if (readBytestream) {
++ readBytestream->onDataAvailable.disconnect(boost::bind(&SOCKS5BytestreamServerSession::handleDataAvailable, this));
++ }
+ state = Finished;
+ }
+
+ void SOCKS5BytestreamServerSession::startTransfer() {
++ std::cout << "START TRANSFER\n";
+ if (state == ReadyForTransfer) {
+ if (readBytestream) {
+ state = WritingData;
+@@ -75,6 +79,13 @@ void SOCKS5BytestreamServerSession::handleDataRead(boost::shared_ptr<SafeByteArr
+ }
+ }
+
++void SOCKS5BytestreamServerSession::handleDataAvailable() {
++ std::cout << "DATA AVAILABLE " << waitingForData << "\n";
++ if (waitingForData) {
++ sendData();
++ }
++}
++
+ void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) {
+ SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl;
+ if (error) {
+@@ -136,6 +147,11 @@ void SOCKS5BytestreamServerSession::process() {
+ connection->write(result);
+ bytestreams->serverSessions[streamID] = this;
+ state = ReadyForTransfer;
++
++ if (readBytestream) {
++ readBytestream->onDataAvailable.connect(boost::bind(&SOCKS5BytestreamServerSession::handleDataAvailable, this));
++ }
++
+ }
+ }
+ }
+@@ -146,8 +162,15 @@ void SOCKS5BytestreamServerSession::sendData() {
+ if (!readBytestream->isFinished()) {
+ try {
+ SafeByteArray dataToSend = createSafeByteArray(*readBytestream->read(chunkSize));
+- connection->write(dataToSend);
+- onBytesSent(dataToSend.size());
++ std::cout << "SEND TRANSFER " << dataToSend.empty() << "\n";
++ if (!dataToSend.empty()) {
++ connection->write(dataToSend);
++ onBytesSent(dataToSend.size());
++ waitingForData = false;
++ }
++ else {
++ waitingForData = true;
++ }
+ }
+ catch (const BytestreamException&) {
+ finish(true);
+diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
+index 4557a36..ed77df8 100644
+--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
++++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h
+@@ -54,6 +54,7 @@ namespace Swift {
+ void process();
+ void handleDataRead(boost::shared_ptr<SafeByteArray>);
+ void handleDisconnected(const boost::optional<Connection::Error>&);
++ void handleDataAvailable();
+ void sendData();
+
+ private:
+@@ -64,5 +65,6 @@ namespace Swift {
+ int chunkSize;
+ boost::shared_ptr<ReadBytestream> readBytestream;
+ boost::shared_ptr<WriteBytestream> writeBytestream;
++ bool waitingForData;
+ };
+ }
More information about the scm-commits
mailing list