3#include <boost/asio.hpp>
17 using Socket = boost::asio::ip::tcp::socket;
37 boost::asio::const_buffer
data;
bool _ready
Is the queue allowed to start another asynchronous send?
boost::asio::ip::tcp::socket Socket
SocketSendQueue(SocketSendQueue const &)=delete
void sendCompleted()
Notifies the queue that the last asynchronous send operation has completed.
std::mutex _queueMutex
The mutex protecting access to the queue.
std::deque< SendItem > _itemQueue
The queue, containing items to asynchronously send using boost.asio.
SocketSendQueue()=default
void dispatch(std::shared_ptr< Socket > sock, boost::asio::const_buffer data, std::function< void()> callback)
Put data in the queue, start processing the queue.
~SocketSendQueue()
If items are left in the queue upon destruction, something went really wrong.
SocketSendQueue & operator=(SocketSendQueue const &)=delete
void process()
This method can be called arbitrarily many times, but enough times to ensure the queue makes progress...
contains the data communication abstraction layer.
std::function< void()> callback
boost::asio::const_buffer data
std::shared_ptr< Socket > sock