diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-01-15 15:58:05 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-01-15 15:58:05 (GMT) |
commit | abf3fbe3dc2b56e1f148b999a3003a0ec7e6ef43 (patch) | |
tree | aeacd7528906e174a370b773e7bcbac52c9489f0 /Swiften/Network/BoostConnection.h | |
parent | a85b96ec1f65e7cf5bd28dd9ab43d656f20e0696 (diff) | |
download | swift-contrib-abf3fbe3dc2b56e1f148b999a3003a0ec7e6ef43.zip swift-contrib-abf3fbe3dc2b56e1f148b999a3003a0ec7e6ef43.tar.bz2 |
Comply with asio's documentation that we cannot call async_write multiple times simultaniously.
Diffstat (limited to 'Swiften/Network/BoostConnection.h')
-rw-r--r-- | Swiften/Network/BoostConnection.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h index da4f7b8..7b15966 100644 --- a/Swiften/Network/BoostConnection.h +++ b/Swiften/Network/BoostConnection.h @@ -8,6 +8,7 @@ #include <boost/asio.hpp> #include <boost/enable_shared_from_this.hpp> +#include <boost/thread/mutex.hpp> #include "Swiften/Network/Connection.h" #include "Swiften/EventLoop/EventOwner.h" @@ -50,11 +51,14 @@ namespace Swift { void handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred); void handleDataWritten(const boost::system::error_code& error); void doRead(); + void doWrite(const ByteArray& data); private: EventLoop* eventLoop; boost::asio::ip::tcp::socket socket_; std::vector<char> readBuffer_; - bool disconnecting_; + boost::mutex writeMutex_; + bool writing_; + ByteArray writeQueue_; }; } |