reference stream sessions by weak_ptr

This commit is contained in:
badaix 2019-10-23 22:23:06 +02:00
parent 43bc4c26b8
commit f47d0df9d7
4 changed files with 176 additions and 191 deletions

View file

@ -51,6 +51,7 @@ public:
// A reference-counted non-modifiable buffer class.
// TODO: add overload for messages
class shared_const_buffer
{
public:
@ -59,6 +60,18 @@ public:
{
}
// // Construct from a message.
// explicit shared_const_buffer(const msg::BaseMessage& message)
// {
// std::ostringstream oss;
// message.serialize(oss);
// data_ = std::shared_ptr<std::vector<char>>(new std::vector<char>(oss.str().begin(), oss.str().end()));
// //std::make_shared<std::vector<char>>(oss.str().begin(), oss.str().end());
// buffer_ = boost::asio::buffer(*data_);
// }
// Implement the ConstBufferSequence requirements.
typedef boost::asio::const_buffer value_type;
typedef const boost::asio::const_buffer* const_iterator;