diff options
Diffstat (limited to 'Swiften/Network/BoostConnection.h')
-rw-r--r-- | Swiften/Network/BoostConnection.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h index 506eedf..7d5ec60 100644 --- a/Swiften/Network/BoostConnection.h +++ b/Swiften/Network/BoostConnection.h @@ -6,12 +6,14 @@ #pragma once -#include <boost/asio.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/ip/tcp.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/thread/mutex.hpp> -#include "Swiften/Network/Connection.h" -#include "Swiften/EventLoop/EventOwner.h" +#include <Swiften/Network/Connection.h> +#include <Swiften/EventLoop/EventOwner.h> +#include <Swiften/Base/SafeByteArray.h> namespace boost { class thread; @@ -36,7 +38,7 @@ namespace Swift { virtual void listen(); virtual void connect(const HostAddressPort& address); virtual void disconnect(); - virtual void write(const ByteArray& data); + virtual void write(const SafeByteArray& data); boost::asio::ip::tcp::socket& getSocket() { return socket_; @@ -51,15 +53,15 @@ 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); + void doWrite(const SafeByteArray& data); private: EventLoop* eventLoop; boost::shared_ptr<boost::asio::io_service> ioService; boost::asio::ip::tcp::socket socket_; - std::vector<char> readBuffer_; + boost::shared_ptr<SafeByteArray> readBuffer_; boost::mutex writeMutex_; bool writing_; - ByteArray writeQueue_; + SafeByteArray writeQueue_; }; } |