Rename to multi_buffer, basic_multi_buffer (API Change):

These classes are renamed:

* streambuf to multi_buffer
* basic_streambuf to basic_multi_buffer
This commit is contained in:
Vinnie Falco
2017-05-09 07:23:07 -07:00
parent bef9ae11ea
commit 69259efe87
45 changed files with 744 additions and 745 deletions
+1 -1
View File
@@ -23,12 +23,12 @@
#include <beast/core/handler_concepts.hpp>
#include <beast/core/handler_helpers.hpp>
#include <beast/core/handler_ptr.hpp>
#include <beast/core/multi_buffer.hpp>
#include <beast/core/ostream.hpp>
#include <beast/core/placeholders.hpp>
#include <beast/core/prepare_buffers.hpp>
#include <beast/core/static_streambuf.hpp>
#include <beast/core/static_string.hpp>
#include <beast/core/stream_concepts.hpp>
#include <beast/core/streambuf.hpp>
#endif
+1 -1
View File
@@ -13,7 +13,7 @@
#include <beast/core/buffer_concepts.hpp>
#include <beast/core/error.hpp>
#include <beast/core/stream_concepts.hpp>
#include <beast/core/streambuf.hpp>
#include <beast/core/multi_buffer.hpp>
#include <beast/core/detail/get_lowest_layer.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/io_service.hpp>
@@ -5,8 +5,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_IMPL_STREAMBUF_IPP
#define BEAST_IMPL_STREAMBUF_IPP
#ifndef BEAST_IMPL_MULTI_BUFFER_IPP
#define BEAST_IMPL_MULTI_BUFFER_IPP
#include <beast/core/detail/type_traits.hpp>
#include <boost/assert.hpp>
@@ -83,7 +83,7 @@ namespace beast {
*/
template<class Allocator>
class basic_streambuf<Allocator>::element
class basic_multi_buffer<Allocator>::element
: public boost::intrusive::list_base_hook<
boost::intrusive::link_mode<
boost::intrusive::normal_link>>
@@ -117,14 +117,14 @@ public:
};
template<class Allocator>
class basic_streambuf<Allocator>::const_buffers_type
class basic_multi_buffer<Allocator>::const_buffers_type
{
basic_streambuf const* sb_;
basic_multi_buffer const* sb_;
friend class basic_streambuf;
friend class basic_multi_buffer;
explicit
const_buffers_type(basic_streambuf const& sb);
const_buffers_type(basic_multi_buffer const& b);
public:
// Why?
@@ -144,14 +144,14 @@ public:
};
template<class Allocator>
class basic_streambuf<Allocator>::mutable_buffers_type
class basic_multi_buffer<Allocator>::mutable_buffers_type
{
basic_streambuf const* sb_;
basic_multi_buffer const* sb_;
friend class basic_streambuf;
friend class basic_multi_buffer;
explicit
mutable_buffers_type(basic_streambuf const& sb);
mutable_buffers_type(basic_multi_buffer const& b);
public:
using value_type = mutable_buffer;
@@ -172,9 +172,9 @@ public:
//------------------------------------------------------------------------------
template<class Allocator>
class basic_streambuf<Allocator>::const_buffers_type::const_iterator
class basic_multi_buffer<Allocator>::const_buffers_type::const_iterator
{
basic_streambuf const* sb_ = nullptr;
basic_multi_buffer const* sb_ = nullptr;
typename list_type::const_iterator it_;
public:
@@ -192,9 +192,9 @@ public:
const_iterator& operator=(const_iterator&& other) = default;
const_iterator& operator=(const_iterator const& other) = default;
const_iterator(basic_streambuf const& sb,
const_iterator(basic_multi_buffer const& b,
typename list_type::const_iterator const& it)
: sb_(&sb)
: sb_(&b)
, it_(it)
{
}
@@ -256,15 +256,15 @@ public:
};
template<class Allocator>
basic_streambuf<Allocator>::const_buffers_type::const_buffers_type(
basic_streambuf const& sb)
: sb_(&sb)
basic_multi_buffer<Allocator>::const_buffers_type::const_buffers_type(
basic_multi_buffer const& b)
: sb_(&b)
{
}
template<class Allocator>
auto
basic_streambuf<Allocator>::const_buffers_type::begin() const ->
basic_multi_buffer<Allocator>::const_buffers_type::begin() const ->
const_iterator
{
return const_iterator{*sb_, sb_->list_.begin()};
@@ -272,7 +272,7 @@ basic_streambuf<Allocator>::const_buffers_type::begin() const ->
template<class Allocator>
auto
basic_streambuf<Allocator>::const_buffers_type::end() const ->
basic_multi_buffer<Allocator>::const_buffers_type::end() const ->
const_iterator
{
return const_iterator{*sb_, sb_->out_ ==
@@ -283,9 +283,9 @@ basic_streambuf<Allocator>::const_buffers_type::end() const ->
//------------------------------------------------------------------------------
template<class Allocator>
class basic_streambuf<Allocator>::mutable_buffers_type::const_iterator
class basic_multi_buffer<Allocator>::mutable_buffers_type::const_iterator
{
basic_streambuf const* sb_ = nullptr;
basic_multi_buffer const* sb_ = nullptr;
typename list_type::const_iterator it_;
public:
@@ -303,9 +303,9 @@ public:
const_iterator& operator=(const_iterator&& other) = default;
const_iterator& operator=(const_iterator const& other) = default;
const_iterator(basic_streambuf const& sb,
const_iterator(basic_multi_buffer const& b,
typename list_type::const_iterator const& it)
: sb_(&sb)
: sb_(&b)
, it_(it)
{
}
@@ -367,15 +367,15 @@ public:
};
template<class Allocator>
basic_streambuf<Allocator>::mutable_buffers_type::mutable_buffers_type(
basic_streambuf const& sb)
: sb_(&sb)
basic_multi_buffer<Allocator>::mutable_buffers_type::mutable_buffers_type(
basic_multi_buffer const& b)
: sb_(&b)
{
}
template<class Allocator>
auto
basic_streambuf<Allocator>::mutable_buffers_type::begin() const ->
basic_multi_buffer<Allocator>::mutable_buffers_type::begin() const ->
const_iterator
{
return const_iterator{*sb_, sb_->out_};
@@ -383,7 +383,7 @@ basic_streambuf<Allocator>::mutable_buffers_type::begin() const ->
template<class Allocator>
auto
basic_streambuf<Allocator>::mutable_buffers_type::end() const ->
basic_multi_buffer<Allocator>::mutable_buffers_type::end() const ->
const_iterator
{
return const_iterator{*sb_, sb_->list_.end()};
@@ -392,14 +392,14 @@ basic_streambuf<Allocator>::mutable_buffers_type::end() const ->
//------------------------------------------------------------------------------
template<class Allocator>
basic_streambuf<Allocator>::~basic_streambuf()
basic_multi_buffer<Allocator>::~basic_multi_buffer()
{
delete_list();
}
template<class Allocator>
basic_streambuf<Allocator>::
basic_streambuf(basic_streambuf&& other)
basic_multi_buffer<Allocator>::
basic_multi_buffer(basic_multi_buffer&& other)
: detail::empty_base_optimization<allocator_type>(
std::move(other.member()))
, alloc_size_(other.alloc_size_)
@@ -420,10 +420,10 @@ basic_streambuf(basic_streambuf&& other)
}
template<class Allocator>
basic_streambuf<Allocator>::
basic_streambuf(basic_streambuf&& other,
basic_multi_buffer<Allocator>::
basic_multi_buffer(basic_multi_buffer&& other,
allocator_type const& alloc)
: basic_streambuf(other.alloc_size_, alloc)
: basic_multi_buffer(other.alloc_size_, alloc)
{
using boost::asio::buffer_copy;
if(this->member() != other.member())
@@ -434,8 +434,8 @@ basic_streambuf(basic_streambuf&& other,
template<class Allocator>
auto
basic_streambuf<Allocator>::operator=(
basic_streambuf&& other) -> basic_streambuf&
basic_multi_buffer<Allocator>::operator=(
basic_multi_buffer&& other) -> basic_multi_buffer&
{
if(this == &other)
return *this;
@@ -448,28 +448,28 @@ basic_streambuf<Allocator>::operator=(
}
template<class Allocator>
basic_streambuf<Allocator>::
basic_streambuf(basic_streambuf const& other)
: basic_streambuf(other.alloc_size_,
basic_multi_buffer<Allocator>::
basic_multi_buffer(basic_multi_buffer const& other)
: basic_multi_buffer(other.alloc_size_,
alloc_traits::select_on_container_copy_construction(other.member()))
{
commit(boost::asio::buffer_copy(prepare(other.size()), other.data()));
}
template<class Allocator>
basic_streambuf<Allocator>::
basic_streambuf(basic_streambuf const& other,
basic_multi_buffer<Allocator>::
basic_multi_buffer(basic_multi_buffer const& other,
allocator_type const& alloc)
: basic_streambuf(other.alloc_size_, alloc)
: basic_multi_buffer(other.alloc_size_, alloc)
{
commit(boost::asio::buffer_copy(prepare(other.size()), other.data()));
}
template<class Allocator>
auto
basic_streambuf<Allocator>::operator=(
basic_streambuf const& other) ->
basic_streambuf&
basic_multi_buffer<Allocator>::operator=(
basic_multi_buffer const& other) ->
basic_multi_buffer&
{
if(this == &other)
return *this;
@@ -483,9 +483,9 @@ basic_streambuf<Allocator>::operator=(
template<class Allocator>
template<class OtherAlloc>
basic_streambuf<Allocator>::basic_streambuf(
basic_streambuf<OtherAlloc> const& other)
: basic_streambuf(other.alloc_size_)
basic_multi_buffer<Allocator>::basic_multi_buffer(
basic_multi_buffer<OtherAlloc> const& other)
: basic_multi_buffer(other.alloc_size_)
{
using boost::asio::buffer_copy;
commit(buffer_copy(prepare(other.size()), other.data()));
@@ -493,10 +493,10 @@ basic_streambuf<Allocator>::basic_streambuf(
template<class Allocator>
template<class OtherAlloc>
basic_streambuf<Allocator>::basic_streambuf(
basic_streambuf<OtherAlloc> const& other,
basic_multi_buffer<Allocator>::basic_multi_buffer(
basic_multi_buffer<OtherAlloc> const& other,
allocator_type const& alloc)
: basic_streambuf(other.alloc_size_, alloc)
: basic_multi_buffer(other.alloc_size_, alloc)
{
using boost::asio::buffer_copy;
commit(buffer_copy(prepare(other.size()), other.data()));
@@ -505,9 +505,9 @@ basic_streambuf<Allocator>::basic_streambuf(
template<class Allocator>
template<class OtherAlloc>
auto
basic_streambuf<Allocator>::operator=(
basic_streambuf<OtherAlloc> const& other) ->
basic_streambuf&
basic_multi_buffer<Allocator>::operator=(
basic_multi_buffer<OtherAlloc> const& other) ->
basic_multi_buffer&
{
using boost::asio::buffer_copy;
clear();
@@ -516,7 +516,7 @@ basic_streambuf<Allocator>::operator=(
}
template<class Allocator>
basic_streambuf<Allocator>::basic_streambuf(
basic_multi_buffer<Allocator>::basic_multi_buffer(
std::size_t alloc_size, Allocator const& alloc)
: detail::empty_base_optimization<allocator_type>(alloc)
, out_(list_.end())
@@ -529,7 +529,7 @@ basic_streambuf<Allocator>::basic_streambuf(
template<class Allocator>
std::size_t
basic_streambuf<Allocator>::capacity() const
basic_multi_buffer<Allocator>::capacity() const
{
auto pos = out_;
if(pos == list_.end())
@@ -542,7 +542,7 @@ basic_streambuf<Allocator>::capacity() const
template<class Allocator>
auto
basic_streambuf<Allocator>::
basic_multi_buffer<Allocator>::
data() const ->
const_buffers_type
{
@@ -551,7 +551,7 @@ data() const ->
template<class Allocator>
auto
basic_streambuf<Allocator>::prepare(size_type n) ->
basic_multi_buffer<Allocator>::prepare(size_type n) ->
mutable_buffers_type
{
list_type reuse;
@@ -630,7 +630,7 @@ basic_streambuf<Allocator>::prepare(size_type n) ->
template<class Allocator>
void
basic_streambuf<Allocator>::commit(size_type n)
basic_multi_buffer<Allocator>::commit(size_type n)
{
if(list_.empty())
return;
@@ -670,7 +670,7 @@ basic_streambuf<Allocator>::commit(size_type n)
template<class Allocator>
void
basic_streambuf<Allocator>::consume(size_type n)
basic_multi_buffer<Allocator>::consume(size_type n)
{
if(list_.empty())
return;
@@ -731,7 +731,7 @@ basic_streambuf<Allocator>::consume(size_type n)
template<class Allocator>
void
basic_streambuf<Allocator>::
basic_multi_buffer<Allocator>::
clear()
{
delete_list();
@@ -745,8 +745,8 @@ clear()
template<class Allocator>
void
basic_streambuf<Allocator>::
move_assign(basic_streambuf& other, std::false_type)
basic_multi_buffer<Allocator>::
move_assign(basic_multi_buffer& other, std::false_type)
{
using boost::asio::buffer_copy;
if(this->member() != other.member())
@@ -760,8 +760,8 @@ move_assign(basic_streambuf& other, std::false_type)
template<class Allocator>
void
basic_streambuf<Allocator>::
move_assign(basic_streambuf& other, std::true_type)
basic_multi_buffer<Allocator>::
move_assign(basic_multi_buffer& other, std::true_type)
{
this->member() = std::move(other.member());
auto const at_end =
@@ -783,23 +783,23 @@ move_assign(basic_streambuf& other, std::true_type)
template<class Allocator>
void
basic_streambuf<Allocator>::
copy_assign(basic_streambuf const& other, std::false_type)
basic_multi_buffer<Allocator>::
copy_assign(basic_multi_buffer const& other, std::false_type)
{
beast::detail::ignore_unused(other);
}
template<class Allocator>
void
basic_streambuf<Allocator>::
copy_assign(basic_streambuf const& other, std::true_type)
basic_multi_buffer<Allocator>::
copy_assign(basic_multi_buffer const& other, std::true_type)
{
this->member() = other.member();
}
template<class Allocator>
void
basic_streambuf<Allocator>::delete_list()
basic_multi_buffer<Allocator>::delete_list()
{
for(auto iter = list_.begin(); iter != list_.end();)
{
@@ -813,7 +813,7 @@ basic_streambuf<Allocator>::delete_list()
template<class Allocator>
void
basic_streambuf<Allocator>::debug_check() const
basic_multi_buffer<Allocator>::debug_check() const
{
#ifndef NDEBUG
using boost::asio::buffer_size;
@@ -853,19 +853,19 @@ basic_streambuf<Allocator>::debug_check() const
template<class Allocator>
std::size_t
read_size_helper(basic_streambuf<
Allocator> const& streambuf, std::size_t max_size)
read_size_helper(basic_multi_buffer<
Allocator> const& multi_buffer, std::size_t max_size)
{
BOOST_ASSERT(max_size >= 1);
// If we already have an allocated
// buffer, try to fill that up first
auto const avail = streambuf.capacity() - streambuf.size();
auto const avail = multi_buffer.capacity() - multi_buffer.size();
if (avail > 0)
return (std::min)(avail, max_size);
// Try to have just one new block allocated
constexpr std::size_t low = 512;
if (streambuf.alloc_size_ > low)
return (std::min)(max_size, streambuf.alloc_size_);
if (multi_buffer.alloc_size_ > low)
return (std::min)(max_size, multi_buffer.alloc_size_);
// ...but enforce a 512 byte minimum.
return (std::min)(max_size, low);
}
+1 -1
View File
@@ -297,7 +297,7 @@ static_streambuf::prepare(std::size_t n) ->
{
if(n > static_cast<std::size_t>(end_ - out_))
throw detail::make_exception<std::length_error>(
"no space in streambuf", __FILE__, __LINE__);
"no space in static_buffer", __FILE__, __LINE__);
last_ = out_ + n;
return mutable_buffers_type{out_, n};
}
@@ -5,8 +5,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_STREAMBUF_HPP
#define BEAST_STREAMBUF_HPP
#ifndef BEAST_MULTI_BUFFER_HPP
#define BEAST_MULTI_BUFFER_HPP
#include <beast/config.hpp>
#include <beast/core/detail/empty_base_optimization.hpp>
@@ -31,7 +31,7 @@ namespace beast {
@tparam Allocator The allocator to use for managing memory.
*/
template<class Allocator>
class basic_streambuf
class basic_multi_buffer
#if ! BEAST_DOXYGEN
: private detail::empty_base_optimization<
typename std::allocator_traits<Allocator>::
@@ -96,7 +96,7 @@ public:
#endif
/// Destructor.
~basic_streambuf();
~basic_multi_buffer();
/** Move constructor.
@@ -107,7 +107,7 @@ public:
an empty input and output sequence, with no internal
buffers allocated.
*/
basic_streambuf(basic_streambuf&&);
basic_multi_buffer(basic_multi_buffer&&);
/** Move constructor.
@@ -121,7 +121,7 @@ public:
@param alloc The allocator to associate with the
stream buffer.
*/
basic_streambuf(basic_streambuf&&,
basic_multi_buffer(basic_multi_buffer&&,
allocator_type const& alloc);
/** Move assignment.
@@ -133,15 +133,15 @@ public:
an empty input and output sequence, with no internal
buffers allocated.
*/
basic_streambuf&
operator=(basic_streambuf&&);
basic_multi_buffer&
operator=(basic_multi_buffer&&);
/** Copy constructor.
This object will have a copy of the other stream
buffer's input sequence, and an empty output sequence.
*/
basic_streambuf(basic_streambuf const&);
basic_multi_buffer(basic_multi_buffer const&);
/** Copy constructor.
@@ -151,7 +151,7 @@ public:
@param alloc The allocator to associate with the
stream buffer.
*/
basic_streambuf(basic_streambuf const&,
basic_multi_buffer(basic_multi_buffer const&,
allocator_type const& alloc);
/** Copy assignment.
@@ -159,7 +159,7 @@ public:
This object will have a copy of the other stream
buffer's input sequence, and an empty output sequence.
*/
basic_streambuf& operator=(basic_streambuf const&);
basic_multi_buffer& operator=(basic_multi_buffer const&);
/** Copy constructor.
@@ -167,7 +167,7 @@ public:
buffer's input sequence, and an empty output sequence.
*/
template<class OtherAlloc>
basic_streambuf(basic_streambuf<OtherAlloc> const&);
basic_multi_buffer(basic_multi_buffer<OtherAlloc> const&);
/** Copy constructor.
@@ -178,7 +178,7 @@ public:
stream buffer.
*/
template<class OtherAlloc>
basic_streambuf(basic_streambuf<OtherAlloc> const&,
basic_multi_buffer(basic_multi_buffer<OtherAlloc> const&,
allocator_type const& alloc);
/** Copy assignment.
@@ -187,7 +187,7 @@ public:
buffer's input sequence, and an empty output sequence.
*/
template<class OtherAlloc>
basic_streambuf& operator=(basic_streambuf<OtherAlloc> const&);
basic_multi_buffer& operator=(basic_multi_buffer<OtherAlloc> const&);
/** Construct a stream buffer.
@@ -200,7 +200,7 @@ public:
unspecified, a default constructed allocator will be used.
*/
explicit
basic_streambuf(std::size_t alloc_size = 1024,
basic_multi_buffer(std::size_t alloc_size = 1024,
Allocator const& alloc = allocator_type{});
/// Returns a copy of the associated allocator.
@@ -289,24 +289,24 @@ public:
template<class OtherAllocator>
friend
std::size_t
read_size_helper(basic_streambuf<
OtherAllocator> const& streambuf, std::size_t max_size);
read_size_helper(basic_multi_buffer<
OtherAllocator> const& multi_buffer, std::size_t max_size);
private:
void
clear();
void
move_assign(basic_streambuf& other, std::false_type);
move_assign(basic_multi_buffer& other, std::false_type);
void
move_assign(basic_streambuf& other, std::true_type);
move_assign(basic_multi_buffer& other, std::true_type);
void
copy_assign(basic_streambuf const& other, std::false_type);
copy_assign(basic_multi_buffer const& other, std::false_type);
void
copy_assign(basic_streambuf const& other, std::true_type);
copy_assign(basic_multi_buffer const& other, std::true_type);
void
delete_list();
@@ -324,10 +324,10 @@ private:
@note Meets the requirements of @b `DynamicBuffer`.
*/
using streambuf = basic_streambuf<std::allocator<char>>;
using multi_buffer = basic_multi_buffer<std::allocator<char>>;
} // beast
#include <beast/core/impl/streambuf.ipp>
#include <beast/core/impl/multi_buffer.ipp>
#endif
+2 -2
View File
@@ -28,9 +28,9 @@ namespace beast {
@par Example
@code
streambuf sb;
multi_buffer b;
...
std::cout << buffers(sb.data()) << std::endl;
std::cout << buffers(b.data()) << std::endl;
@endcode
@param b An object meeting the requirements of @b ConstBufferSequence
+3 -3
View File
@@ -10,7 +10,7 @@
#include <beast/config.hpp>
#include <beast/core/error.hpp>
#include <beast/core/streambuf.hpp>
#include <beast/core/multi_buffer.hpp>
#include <beast/http/message.hpp>
namespace beast {
@@ -111,11 +111,11 @@ private:
};
};
/** A dynamic message body represented by a @ref streambuf
/** A dynamic message body represented by a @ref multi_buffer
Meets the requirements of @b `Body`.
*/
using dynamic_body = basic_dynamic_body<streambuf>;
using dynamic_body = basic_dynamic_body<multi_buffer>;
} // http
} // beast
+21 -21
View File
@@ -17,7 +17,7 @@
#include <beast/core/handler_helpers.hpp>
#include <beast/core/handler_ptr.hpp>
#include <beast/core/stream_concepts.hpp>
#include <beast/core/streambuf.hpp>
#include <beast/core/multi_buffer.hpp>
#include <beast/core/detail/sync_ostream.hpp>
#include <boost/asio/write.hpp>
#include <condition_variable>
@@ -89,15 +89,15 @@ class write_streambuf_op
{
bool cont;
Stream& s;
streambuf sb;
multi_buffer b;
int state = 0;
data(Handler& handler, Stream& s_,
streambuf&& sb_)
multi_buffer&& sb_)
: cont(beast_asio_helpers::
is_continuation(handler))
, s(s_)
, sb(std::move(sb_))
, b(std::move(sb_))
{
}
};
@@ -167,7 +167,7 @@ operator()(error_code ec, std::size_t, bool again)
{
d.state = 99;
boost::asio::async_write(d.s,
d.sb.data(), std::move(*this));
d.b.data(), std::move(*this));
return;
}
}
@@ -200,14 +200,14 @@ write(SyncWriteStream& stream,
{
static_assert(is_SyncWriteStream<SyncWriteStream>::value,
"SyncWriteStream requirements not met");
streambuf sb;
multi_buffer b;
{
auto os = ostream(sb);
auto os = ostream(b);
detail::write_start_line(os, msg);
detail::write_fields(os, msg.fields);
os << "\r\n";
}
boost::asio::write(stream, sb.data(), ec);
boost::asio::write(stream, b.data(), ec);
}
template<class AsyncWriteStream,
@@ -223,16 +223,16 @@ async_write(AsyncWriteStream& stream,
"AsyncWriteStream requirements not met");
beast::async_completion<WriteHandler,
void(error_code)> completion{handler};
streambuf sb;
multi_buffer b;
{
auto os = ostream(sb);
auto os = ostream(b);
detail::write_start_line(os, msg);
detail::write_fields(os, msg.fields);
os << "\r\n";
}
detail::write_streambuf_op<AsyncWriteStream,
decltype(completion.handler)>{
completion.handler, stream, std::move(sb)};
completion.handler, stream, std::move(b)};
return completion.result.get();
}
@@ -245,7 +245,7 @@ struct write_preparation
{
message<isRequest, Body, Fields> const& msg;
typename Body::writer w;
streambuf sb;
multi_buffer b;
bool chunked;
bool close;
@@ -270,7 +270,7 @@ struct write_preparation
if(ec)
return;
auto os = ostream(sb);
auto os = ostream(b);
write_start_line(os, msg);
write_fields(os, msg.fields);
os << "\r\n";
@@ -318,12 +318,12 @@ class write_op
// write header and body
if(d.wp.chunked)
boost::asio::async_write(d.s,
buffer_cat(d.wp.sb.data(),
buffer_cat(d.wp.b.data(),
chunk_encode(false, buffers)),
std::move(self_));
else
boost::asio::async_write(d.s,
buffer_cat(d.wp.sb.data(),
buffer_cat(d.wp.b.data(),
buffers), std::move(self_));
}
};
@@ -452,7 +452,7 @@ operator()(error_code ec, std::size_t, bool again)
// sent header and body
case 2:
d.wp.sb.consume(d.wp.sb.size());
d.wp.b.consume(d.wp.b.size());
d.state = 3;
break;
@@ -508,8 +508,8 @@ class writef0_lambda
public:
writef0_lambda(SyncWriteStream& stream,
DynamicBuffer const& sb, bool chunked, error_code& ec)
: sb_(sb)
DynamicBuffer const& b, bool chunked, error_code& ec)
: sb_(b)
, stream_(stream)
, chunked_(chunked)
, ec_(ec)
@@ -602,11 +602,11 @@ write(SyncWriteStream& stream,
return;
auto result = wp.w.write(
ec, detail::writef0_lambda<
SyncWriteStream, decltype(wp.sb)>{
stream, wp.sb, wp.chunked, ec});
SyncWriteStream, decltype(wp.b)>{
stream, wp.b, wp.chunked, ec});
if(ec)
return;
wp.sb.consume(wp.sb.size());
wp.b.consume(wp.b.size());
if(! result)
{
detail::writef_lambda<SyncWriteStream> wf{
+1 -1
View File
@@ -98,7 +98,7 @@ class stream : public detail::stream_base
{
friend class stream_test;
dynabuf_readstream<NextLayer, streambuf> stream_;
dynabuf_readstream<NextLayer, multi_buffer> stream_;
public:
/// The type of the next layer.