diff options
6 files changed, 18 insertions, 9 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp index b371078..0a05293 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp @@ -160,7 +160,7 @@ void SOCKS5BytestreamClientSession::startReceiving(boost::shared_ptr<WriteBytest state = Reading; writeBytestream = writeStream; writeBytestream->write(unprocessedData); - onBytesReceived(unprocessedData.size()); + //onBytesReceived(unprocessedData.size()); unprocessedData.clear(); } else { SWIFT_LOG(debug) << "Session isn't ready for transfer yet!" << std::endl; @@ -241,7 +241,7 @@ void SOCKS5BytestreamClientSession::handleDataRead(boost::shared_ptr<SafeByteArr } else { writeBytestream->write(createByteArray(vecptr(*data), data->size())); - onBytesReceived(data->size()); + //onBytesReceived(data->size()); } } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h index 287cf3b..cf731c1 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h @@ -64,7 +64,7 @@ public: boost::signal<void (boost::optional<FileTransferError>)> onFinished; boost::signal<void (size_t)> onBytesSent; - boost::signal<void (size_t)> onBytesReceived; + // boost::signal<void (size_t)> onBytesReceived; private: void process(); diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp index 12a0f12..f393c8d 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp @@ -68,7 +68,7 @@ void SOCKS5BytestreamServerSession::startReceiving(boost::shared_ptr<WriteBytest writeBytestream = stream; state = ReadingData; writeBytestream->write(unprocessedData); - onBytesReceived(unprocessedData.size()); + // onBytesReceived(unprocessedData.size()); unprocessedData.clear(); } @@ -82,7 +82,7 @@ void SOCKS5BytestreamServerSession::handleDataRead(boost::shared_ptr<SafeByteArr process(); } else { writeBytestream->write(createByteArray(vecptr(*data), data->size())); - onBytesReceived(data->size()); + // onBytesReceived(data->size()); } } diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h index 762db8b..0b35e4a 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.h @@ -50,7 +50,7 @@ namespace Swift { boost::signal<void (boost::optional<FileTransferError>)> onFinished; boost::signal<void (unsigned long long)> onBytesSent; - boost::signal<void (unsigned long long)> onBytesReceived; + // boost::signal<void (unsigned long long)> onBytesReceived; const std::string& getStreamID() const { return streamID; diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp index 133b006..65ff577 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.cpp +++ b/Swiften/Network/PlatformNATTraversalWorker.cpp @@ -11,6 +11,7 @@ #include <boost/numeric/conversion/cast.hpp> #include <Swiften/Base/Log.h> +#include <Swiften/EventLoop/EventLoop.h> #include <Swiften/Network/NATTraversalGetPublicIPRequest.h> #include <Swiften/Network/NATTraversalForwardPortRequest.h> #include <Swiften/Network/NATTraversalRemovePortForwardingRequest.h> @@ -42,6 +43,10 @@ class PlatformNATTraversalRequest : public boost::enable_shared_from_this<Platfo return worker->getNATTraversalInterface(); } + EventLoop* getEventLoop() const { + return worker->getEventLoop(); + } + virtual void runBlocking() = 0; @@ -63,7 +68,7 @@ class PlatformNATTraversalGetPublicIPRequest : public NATTraversalGetPublicIPReq } virtual void runBlocking() { - onResult(getNATTraversalInterface()->getPublicIP()); + getEventLoop()->postEvent(boost::bind(boost::ref(onResult), getNATTraversalInterface()->getPublicIP())); } }; @@ -81,7 +86,7 @@ class PlatformNATTraversalForwardPortRequest : public NATTraversalForwardPortReq } virtual void runBlocking() { - onResult(getNATTraversalInterface()->addPortForward(boost::numeric_cast<int>(localIP), boost::numeric_cast<int>(publicIP))); + getEventLoop()->postEvent(boost::bind(boost::ref(onResult), getNATTraversalInterface()->addPortForward(boost::numeric_cast<int>(localIP), boost::numeric_cast<int>(publicIP)))); } private: @@ -103,7 +108,7 @@ class PlatformNATTraversalRemovePortForwardingRequest : public NATTraversalRemov } virtual void runBlocking() { - onResult(getNATTraversalInterface()->removePortForward(mapping)); + getEventLoop()->postEvent(boost::bind(boost::ref(onResult), getNATTraversalInterface()->removePortForward(mapping))); } private: diff --git a/Swiften/Network/PlatformNATTraversalWorker.h b/Swiften/Network/PlatformNATTraversalWorker.h index 6148705..91b83f8 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.h +++ b/Swiften/Network/PlatformNATTraversalWorker.h @@ -46,6 +46,10 @@ namespace Swift { void start(); void stop(); + EventLoop* getEventLoop() const { + return eventLoop; + } + private: EventLoop* eventLoop; bool stopRequested; |