mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
Add buffer_size
This commit is contained in:
@@ -6,6 +6,7 @@ Version 209:
|
||||
* Qualify buffer_copy, don't qualify buffer_size
|
||||
* Add dynamic_buffer_ref
|
||||
* Refactor quickref.xml
|
||||
* Add buffer_size
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -20,6 +20,14 @@ transferred.
|
||||
|
||||
[table Buffer Algorithms and Types
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__buffer_size `buffer_size`]
|
||||
][
|
||||
This is a more reliable version of
|
||||
[@boost:/doc/html/boost_asio/reference/buffer_size.html `net::buffer_size`]
|
||||
which is easier to use and also works for types which are convertible
|
||||
to `net::const_buffer` or `net::mutable_buffer`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__buffers_cat `buffers_cat`]
|
||||
][
|
||||
|
@@ -66,6 +66,7 @@
|
||||
<member><link linkend="beast.ref.boost__beast__bind_back_handler">bind_back_handler</link> <emphasis role="green">🞲</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__bind_front_handler">bind_front_handler</link> <emphasis role="green">🞲</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__bind_handler">bind_handler</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__buffer_size">buffer_size</link> <emphasis role="green">🞲</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__close_socket">close_socket</link> <emphasis role="green">🞲</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__generic_category">generic_category</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__get_lowest_layer">get_lowest_layer</link> <emphasis role="green">🞲</emphasis></member>
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_CORE_DETAIL_FLAT_STREAM_HPP
|
||||
#define BOOST_BEAST_CORE_DETAIL_FLAT_STREAM_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -42,7 +43,6 @@ public:
|
||||
auto last = net::buffer_sequence_end(buffers);
|
||||
if(first != last)
|
||||
{
|
||||
using net::buffer_size;
|
||||
result.size = buffer_size(*first);
|
||||
if(result.size < limit)
|
||||
{
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <boost/beast/core/dynamic_buffer_ref.hpp>
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_adaptor.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
@@ -44,7 +45,6 @@ buffer_shift(MutableBuffers const& out, ConstBuffers const& in)
|
||||
auto out_pos = net::buffer_sequence_end(out);
|
||||
auto const in_begin = net::buffer_sequence_begin(in);
|
||||
auto const out_begin = net::buffer_sequence_begin(out);
|
||||
using net::buffer_size;
|
||||
BOOST_ASSERT(buffer_size(in) == buffer_size(out));
|
||||
if(in_pos == in_begin || out_pos == out_begin)
|
||||
return;
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_TEST_IMPL_STREAM_HPP
|
||||
#define BOOST_BEAST_TEST_IMPL_STREAM_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/stream_algorithm.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
|
||||
@@ -110,7 +111,6 @@ stream::
|
||||
str() const
|
||||
{
|
||||
auto const bs = in_->b.data();
|
||||
using net::buffer_size;
|
||||
if(buffer_size(bs) == 0)
|
||||
return {};
|
||||
auto const b = beast::buffers_front(bs);
|
||||
@@ -189,7 +189,6 @@ read_some(MutableBufferSequence const& buffers,
|
||||
"MutableBufferSequence requirements not met");
|
||||
if(in_->fc && in_->fc->fail(ec))
|
||||
return 0;
|
||||
using net::buffer_size;
|
||||
if(buffer_size(buffers) == 0)
|
||||
{
|
||||
ec.clear();
|
||||
@@ -252,7 +251,6 @@ async_read_some(
|
||||
{
|
||||
std::unique_lock<std::mutex> lock{in_->m};
|
||||
BOOST_ASSERT(! in_->op);
|
||||
using net::buffer_size;
|
||||
if( buffer_size(buffers) == 0 ||
|
||||
buffer_size(in_->b.data()) > 0)
|
||||
{
|
||||
@@ -328,7 +326,6 @@ write_some(
|
||||
BOOST_ASSERT(out->code == status::ok);
|
||||
if(in_->fc && in_->fc->fail(ec))
|
||||
return 0;
|
||||
using net::buffer_size;
|
||||
auto const n = std::min<std::size_t>(
|
||||
buffer_size(buffers), in_->write_max);
|
||||
std::unique_lock<std::mutex> lock{out->m};
|
||||
@@ -379,7 +376,6 @@ async_write_some(ConstBufferSequence const& buffers,
|
||||
}
|
||||
else
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const n = std::min<std::size_t>(
|
||||
buffer_size(buffers), in_->write_max);
|
||||
std::unique_lock<std::mutex> lock{out->m};
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/beast/core/basic_timeout_stream.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/beast/core/buffered_read_stream.hpp>
|
||||
#include <boost/beast/core/buffers_adaptor.hpp>
|
||||
|
124
include/boost/beast/core/buffer_size.hpp
Normal file
124
include/boost/beast/core/buffer_size.hpp
Normal file
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_BUFFER_SIZE_HPP
|
||||
#define BOOST_BEAST_BUFFER_SIZE_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/detail/static_const.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T, class = void>
|
||||
struct has_buffer_size_impl : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct has_buffer_size_impl<T, boost::void_t<
|
||||
decltype(std::declval<std::size_t&>() =
|
||||
std::declval<T const&>().buffer_size_impl())>>
|
||||
: std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
struct buffer_size_impl
|
||||
{
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
std::is_convertible<
|
||||
B, net::const_buffer>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
return net::const_buffer(b).size();
|
||||
}
|
||||
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
! std::is_convertible<
|
||||
B, net::const_buffer>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
net::is_const_buffer_sequence<B>::value &&
|
||||
! has_buffer_size_impl<B>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(b);
|
||||
}
|
||||
|
||||
template<
|
||||
class B,
|
||||
class = typename std::enable_if<
|
||||
! std::is_convertible<B, net::const_buffer>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
net::is_const_buffer_sequence<B>::value>::type,
|
||||
class = typename std::enable_if<
|
||||
has_buffer_size_impl<B>::value>::type>
|
||||
std::size_t
|
||||
operator()(B const& b) const
|
||||
{
|
||||
return b.buffer_size_impl();
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
/** Return the total number of bytes in a buffer or buffer sequence
|
||||
|
||||
This function returns the total number of bytes in a buffer,
|
||||
buffer sequence, or object convertible to a buffer. Specifically
|
||||
it may be passed:
|
||||
|
||||
@li A <em>ConstBufferSequence</em> or <em>MutableBufferSequence</em>
|
||||
|
||||
@li A `net::const_buffer` or `net::mutable_buffer`
|
||||
|
||||
@li An object convertible to `net::const_buffer`
|
||||
|
||||
This function is designed as an easier-to-use replacement for
|
||||
`net::buffer_size`. It recognizes customization points found through
|
||||
argument-dependent lookup. The call `beast::buffer_size(b)` is
|
||||
equivalent to performing:
|
||||
@code
|
||||
using namespace net;
|
||||
buffer_size(b);
|
||||
@endcode
|
||||
In addition this handles types which are convertible to
|
||||
`net::const_buffer`; these are not handled by `net::buffer_size`.
|
||||
|
||||
@note It is expected that a future version of Networking will
|
||||
incorporate the features of this function.
|
||||
|
||||
@param buffers The buffer or buffer sequence to calculate the size of.
|
||||
|
||||
@return The total number of bytes in the buffer or sequence.
|
||||
*/
|
||||
#if BOOST_BEAST_DOXYGEN
|
||||
template<class Buffers>
|
||||
void
|
||||
buffer_size(Buffers const& buffers);
|
||||
#else
|
||||
BOOST_BEAST_INLINE_VARIABLE(buffer_size, detail::buffer_size_impl)
|
||||
#endif
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_BUFFERS_PREFIX_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/optional/optional.hpp> // for in_place_init_t
|
||||
#include <algorithm>
|
||||
@@ -128,25 +129,14 @@ public:
|
||||
end() const;
|
||||
|
||||
#if ! BOOST_BEAST_DOXYGEN
|
||||
template<class Buffers>
|
||||
friend
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<Buffers> const& buffers);
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef BOOST_BEAST_DOXYGEN
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::const_buffer> const& buffers);
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::mutable_buffer> const& buffers);
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Returns a prefix of a constant or mutable buffer sequence.
|
||||
|
@@ -44,7 +44,6 @@ namespace beast {
|
||||
void send(SyncWriteStream& stream, ConstBufferSequence const& buffers)
|
||||
{
|
||||
buffers_suffix<ConstBufferSequence> bs{buffers};
|
||||
using net::buffer_size;
|
||||
while(buffer_size(bs) > 0)
|
||||
bs.consume(stream.write_some(bs));
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_BUFFERS_TO_STRING_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
@@ -48,9 +49,8 @@ buffers_to_string(ConstBufferSequence const& buffers)
|
||||
net::is_const_buffer_sequence<ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
std::string result;
|
||||
using net::buffer_size;
|
||||
result.reserve(buffer_size(buffers));
|
||||
for(auto const buffer : beast::buffers_range_ref(buffers))
|
||||
for(auto const buffer : buffers_range_ref(buffers))
|
||||
result.append(static_cast<char const*>(
|
||||
buffer.data()), buffer.size());
|
||||
return result;
|
||||
|
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
@@ -44,151 +43,82 @@ namespace detail {
|
||||
template<std::size_t R>
|
||||
class chacha
|
||||
{
|
||||
void generate_block();
|
||||
void chacha_core();
|
||||
|
||||
alignas(16) std::uint32_t block_[16];
|
||||
std::uint32_t keysetup_[8];
|
||||
std::uint64_t ctr_ = 0;
|
||||
int idx_ = 16;
|
||||
|
||||
void generate_block()
|
||||
{
|
||||
std::uint32_t constexpr constants[4] = {
|
||||
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 };
|
||||
std::uint32_t input[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
input[i] = constants[i];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
input[4 + i] = keysetup_[i];
|
||||
input[12] = (ctr_ / 16) & 0xffffffffu;
|
||||
input[13] = (ctr_ / 16) >> 32;
|
||||
input[14] = input[15] = 0xdeadbeef; // Could use 128-bit counter.
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] = input[i];
|
||||
chacha_core();
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] += input[i];
|
||||
}
|
||||
|
||||
void chacha_core()
|
||||
{
|
||||
#define BOOST_BEAST_CHACHA_ROTL32(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
#define BOOST_BEAST_CHACHA_QUARTERROUND(x, a, b, c, d) \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 16); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 12); \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 8); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 7)
|
||||
|
||||
for (unsigned i = 0; i < R; i += 2)
|
||||
{
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 4, 8, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 5, 9, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 6, 10, 14);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 7, 11, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 5, 10, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 6, 11, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 7, 8, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 4, 9, 14);
|
||||
}
|
||||
|
||||
#undef BOOST_BEAST_CHACHA_QUARTERROUND
|
||||
#undef BOOST_BEAST_CHACHA_ROTL32
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr std::size_t state_size = sizeof(chacha::keysetup_);
|
||||
|
||||
using result_type = std::uint32_t;
|
||||
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream);
|
||||
|
||||
std::uint32_t
|
||||
operator()();
|
||||
|
||||
#if 0
|
||||
template<std::size_t R_>
|
||||
friend
|
||||
bool
|
||||
operator==(chacha<R_> const& lhs, chacha<R_> const& rhs);
|
||||
|
||||
template<std::size_t R_>
|
||||
friend
|
||||
bool
|
||||
operator!=(chacha<R_> const& lhs, chacha<R_> const& rhs);
|
||||
|
||||
static
|
||||
constexpr
|
||||
std::uint32_t
|
||||
min()
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream)
|
||||
{
|
||||
return (std::numeric_limits<std::uint32_t>::min)();
|
||||
for (int i = 0; i < 6; ++i)
|
||||
keysetup_[i] = v[i];
|
||||
keysetup_[6] = v[6] + (stream & 0xffffffff);
|
||||
keysetup_[7] = v[7] + ((stream >> 32) & 0xffffffff);
|
||||
}
|
||||
|
||||
static
|
||||
constexpr
|
||||
std::uint32_t
|
||||
max()
|
||||
operator()()
|
||||
{
|
||||
return (std::numeric_limits<std::uint32_t>::max)();
|
||||
if(idx_ == 16)
|
||||
{
|
||||
idx_ = 0;
|
||||
++ctr_;
|
||||
generate_block();
|
||||
}
|
||||
return block_[idx_++];
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template<std::size_t R>
|
||||
chacha<R>::
|
||||
chacha(std::uint32_t const* v, std::uint64_t stream)
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
keysetup_[i] = v[i];
|
||||
keysetup_[6] = v[6] + (stream & 0xffffffff);
|
||||
keysetup_[7] = v[7] + ((stream >> 32) & 0xffffffff);
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
std::uint32_t
|
||||
chacha<R>::
|
||||
operator()()
|
||||
{
|
||||
if(idx_ == 16)
|
||||
{
|
||||
idx_ = 0;
|
||||
++ctr_;
|
||||
generate_block();
|
||||
}
|
||||
return block_[idx_++];
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
void
|
||||
chacha<R>::
|
||||
generate_block()
|
||||
{
|
||||
std::uint32_t constexpr constants[4] = {
|
||||
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574 };
|
||||
std::uint32_t input[16];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
input[i] = constants[i];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
input[4 + i] = keysetup_[i];
|
||||
input[12] = (ctr_ / 16) & 0xffffffffu;
|
||||
input[13] = (ctr_ / 16) >> 32;
|
||||
input[14] = input[15] = 0xdeadbeef; // Could use 128-bit counter.
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] = input[i];
|
||||
chacha_core();
|
||||
for (int i = 0; i < 16; ++i)
|
||||
block_[i] += input[i];
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
void
|
||||
chacha<R>::
|
||||
chacha_core()
|
||||
{
|
||||
#define BOOST_BEAST_CHACHA_ROTL32(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
|
||||
#define BOOST_BEAST_CHACHA_QUARTERROUND(x, a, b, c, d) \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 16); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 12); \
|
||||
x[a] = x[a] + x[b]; x[d] ^= x[a]; x[d] = BOOST_BEAST_CHACHA_ROTL32(x[d], 8); \
|
||||
x[c] = x[c] + x[d]; x[b] ^= x[c]; x[b] = BOOST_BEAST_CHACHA_ROTL32(x[b], 7)
|
||||
|
||||
for (unsigned i = 0; i < R; i += 2)
|
||||
{
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 4, 8, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 5, 9, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 6, 10, 14);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 7, 11, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 0, 5, 10, 15);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 1, 6, 11, 12);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 2, 7, 8, 13);
|
||||
BOOST_BEAST_CHACHA_QUARTERROUND(block_, 3, 4, 9, 14);
|
||||
}
|
||||
|
||||
#undef BOOST_BEAST_CHACHA_QUARTERROUND
|
||||
#undef BOOST_BEAST_CHACHA_ROTL32
|
||||
}
|
||||
|
||||
//#endif
|
||||
|
||||
#if 0
|
||||
// Implement <random> interface.
|
||||
|
||||
template<std::size_t R>
|
||||
bool
|
||||
operator==(chacha<R> const& lhs, chacha<R> const& rhs)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
if (lhs.keysetup_[i] != rhs.keysetup_[i])
|
||||
return false;
|
||||
return lhs.ctr_ == rhs.ctr_;
|
||||
}
|
||||
|
||||
template<std::size_t R>
|
||||
bool
|
||||
operator!=(chacha<R> const& lhs, chacha<R> const& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
} // boost
|
||||
|
@@ -76,7 +76,7 @@ namespace net = boost::asio;
|
||||
#define BOOST_BEAST_INLINE_VARIABLE(name, type) \
|
||||
inline namespace \
|
||||
{ \
|
||||
constexpr auto &name = \
|
||||
constexpr auto& name = \
|
||||
::boost::beast::detail::static_const<type>::value; \
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_ADAPTOR_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_ADAPTOR_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
@@ -400,7 +401,6 @@ buffers_adaptor(MutableBufferSequence const& bs)
|
||||
, max_size_(
|
||||
[&bs]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(bs);
|
||||
}())
|
||||
{
|
||||
@@ -418,7 +418,6 @@ buffers_adaptor(
|
||||
, max_size_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(bs_);
|
||||
}())
|
||||
{
|
||||
@@ -502,7 +501,6 @@ prepare(std::size_t n) ->
|
||||
end_ = out_;
|
||||
if(end_ != net::buffer_sequence_end(bs_))
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto size = buffer_size(*end_) - out_pos_;
|
||||
if(n > size)
|
||||
{
|
||||
@@ -545,7 +543,6 @@ commit(std::size_t n) noexcept
|
||||
auto const last = std::prev(end_);
|
||||
while(out_ != last)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const avail =
|
||||
buffer_size(*out_) - out_pos_;
|
||||
if(n < avail)
|
||||
@@ -579,7 +576,6 @@ consume(std::size_t n) noexcept
|
||||
{
|
||||
while(begin_ != out_)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const avail =
|
||||
buffer_size(*begin_) - in_pos_;
|
||||
if(n < avail)
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_PREFIX_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_PREFIX_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
@@ -149,7 +150,6 @@ setup(std::size_t size)
|
||||
auto const last = bs_.end();
|
||||
while(end_ != last)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const len = buffer_size(*end_++);
|
||||
if(len >= size)
|
||||
{
|
||||
@@ -248,14 +248,6 @@ end() const ->
|
||||
*this, std::true_type{}};
|
||||
}
|
||||
|
||||
template<class Buffers>
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
Buffers> const& buffers)
|
||||
{
|
||||
return buffers.size_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
@@ -290,14 +282,13 @@ public:
|
||||
std::forward<Args>(args)...))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::const_buffer> const& buffers)
|
||||
{
|
||||
return buffers.size();
|
||||
}
|
||||
std::size_t
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -333,14 +324,13 @@ public:
|
||||
std::forward<Args>(args)...))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::size_t
|
||||
buffer_size(buffers_prefix_view<
|
||||
net::mutable_buffer> const& buffers)
|
||||
{
|
||||
return buffers.size();
|
||||
}
|
||||
std::size_t
|
||||
buffer_size_impl() const noexcept
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
};
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_BUFFERS_SUFFIX_HPP
|
||||
#define BOOST_BEAST_IMPL_BUFFERS_SUFFIX_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <algorithm>
|
||||
@@ -206,7 +207,6 @@ consume(std::size_t amount)
|
||||
net::buffer_sequence_end(bs_);
|
||||
for(;amount > 0 && begin_ != end; ++begin_)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const len =
|
||||
buffer_size(*begin_) - skip_;
|
||||
if(amount < len)
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_MULTI_BUFFER_HPP
|
||||
#define BOOST_BEAST_IMPL_MULTI_BUFFER_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/core/exchange.hpp>
|
||||
@@ -195,11 +196,10 @@ public:
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
friend
|
||||
std::size_t
|
||||
buffer_size(readable_bytes const& buffers) noexcept
|
||||
buffer_size() const noexcept
|
||||
{
|
||||
return buffers.b_->size();
|
||||
return b_->size();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1132,7 +1132,6 @@ basic_multi_buffer<Allocator>::
|
||||
debug_check() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
using net::buffer_size;
|
||||
BOOST_ASSERT(buffer_size(data()) == in_size_);
|
||||
if(list_.empty())
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_MAKE_PRINTABLE_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <ostream>
|
||||
|
||||
@@ -73,7 +74,6 @@ operator<<(std::ostream& os,
|
||||
void
|
||||
print (ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
std::cout <<
|
||||
"Buffer size: " << buffer_size(buffers) << " bytes\n"
|
||||
"Buffer data: '" << make_printable(buffers) << "'\n";
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/buffer.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
@@ -88,7 +89,6 @@ struct basic_dynamic_body
|
||||
put(ConstBufferSequence const& buffers,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const n = buffer_size(buffers);
|
||||
if(body_.size() > body_.max_size() - n)
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_HTTP_BUFFER_BODY_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/type_traits.hpp>
|
||||
@@ -132,7 +133,6 @@ struct buffer_body
|
||||
body_.data = static_cast<char*>(
|
||||
body_.data) + bytes_transferred;
|
||||
body_.size -= bytes_transferred;
|
||||
using net::buffer_size;
|
||||
if(bytes_transferred == buffer_size(buffers))
|
||||
ec = {};
|
||||
else
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/static_string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
@@ -106,7 +107,6 @@ put(ConstBufferSequence const& buffers,
|
||||
// single buffer
|
||||
return put(net::const_buffer(*p), ec);
|
||||
}
|
||||
using net::buffer_size;
|
||||
auto const size = buffer_size(buffers);
|
||||
if(size <= max_stack_buffer)
|
||||
return put_from_stack(size, buffers, ec);
|
||||
@@ -130,7 +130,6 @@ put(net::const_buffer const& buffer,
|
||||
error_code& ec)
|
||||
{
|
||||
BOOST_ASSERT(state_ != state::complete);
|
||||
using net::buffer_size;
|
||||
auto p = static_cast<char const*>(buffer.data());
|
||||
auto n = buffer.size();
|
||||
auto const p0 = p;
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/varint.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/detail/rfc7230.hpp>
|
||||
@@ -89,11 +90,7 @@ template<class ConstBufferSequence>
|
||||
chunk_body<ConstBufferSequence>::
|
||||
chunk_body(ConstBufferSequence const& buffers)
|
||||
: view_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(buffers);
|
||||
}(),
|
||||
buffer_size(buffers),
|
||||
net::const_buffer{nullptr, 0},
|
||||
chunk_crlf{},
|
||||
buffers,
|
||||
@@ -107,11 +104,7 @@ chunk_body(
|
||||
ConstBufferSequence const& buffers,
|
||||
string_view extensions)
|
||||
: view_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(buffers);
|
||||
}(),
|
||||
buffer_size(buffers),
|
||||
net::const_buffer{
|
||||
extensions.data(), extensions.size()},
|
||||
chunk_crlf{},
|
||||
@@ -130,11 +123,7 @@ chunk_body(
|
||||
typename std::decay<ChunkExtensions>::type>>(
|
||||
std::forward<ChunkExtensions>(extensions)))
|
||||
, view_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(buffers);
|
||||
}(),
|
||||
buffer_size(buffers),
|
||||
exts_->str(),
|
||||
chunk_crlf{},
|
||||
buffers,
|
||||
@@ -153,11 +142,7 @@ chunk_body(
|
||||
typename std::decay<ChunkExtensions>::type>>(allocator,
|
||||
std::forward<ChunkExtensions>(extensions)))
|
||||
, view_(
|
||||
[&]
|
||||
{
|
||||
using net::buffer_size;
|
||||
return buffer_size(buffers);
|
||||
}(),
|
||||
buffer_size(buffers),
|
||||
exts_->str(),
|
||||
chunk_crlf{},
|
||||
buffers,
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/buffers_ref.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/status.hpp>
|
||||
@@ -70,7 +71,6 @@ void
|
||||
serializer<isRequest, Body, Fields>::
|
||||
next(error_code& ec, Visit&& visit)
|
||||
{
|
||||
using net::buffer_size;
|
||||
switch(s_)
|
||||
{
|
||||
case do_construct:
|
||||
@@ -289,7 +289,6 @@ void
|
||||
serializer<isRequest, Body, Fields>::
|
||||
consume(std::size_t n)
|
||||
{
|
||||
using net::buffer_size;
|
||||
switch(s_)
|
||||
{
|
||||
case do_header:
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_HTTP_SPAN_BODY_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/span.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
@@ -95,7 +96,6 @@ public:
|
||||
put(ConstBufferSequence const& buffers,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const n = buffer_size(buffers);
|
||||
auto const len = body_.size();
|
||||
if(n > len)
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_HTTP_STRING_BODY_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
@@ -117,7 +118,6 @@ public:
|
||||
put(ConstBufferSequence const& buffers,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const extra = buffer_size(buffers);
|
||||
auto const size = body_.size();
|
||||
try
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_HTTP_VECTOR_BODY_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
@@ -111,7 +112,6 @@ public:
|
||||
put(ConstBufferSequence const& buffers,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const n = buffer_size(buffers);
|
||||
auto const len = body_.size();
|
||||
try
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_FRAME_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_DETAIL_FRAME_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/websocket/error.hpp>
|
||||
#include <boost/beast/websocket/rfc6455.hpp>
|
||||
#include <boost/beast/websocket/detail/utf8_checker.hpp>
|
||||
@@ -229,7 +230,6 @@ template<class Buffers>
|
||||
void
|
||||
read_ping(ping_data& data, Buffers const& bs)
|
||||
{
|
||||
using net::buffer_size;
|
||||
BOOST_ASSERT(buffer_size(bs) <= data.max_size());
|
||||
data.resize(buffer_size(bs));
|
||||
net::buffer_copy(net::mutable_buffer{
|
||||
@@ -246,9 +246,7 @@ read_close(
|
||||
Buffers const& bs,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer;
|
||||
using namespace boost::endian;
|
||||
using net::buffer_size;
|
||||
auto n = buffer_size(bs);
|
||||
BOOST_ASSERT(n <= 125);
|
||||
if(n == 0)
|
||||
@@ -266,7 +264,7 @@ read_close(
|
||||
buffers_suffix<Buffers> cb(bs);
|
||||
{
|
||||
std::uint8_t b[2];
|
||||
net::buffer_copy(buffer(b), cb);
|
||||
net::buffer_copy(net::buffer(b), cb);
|
||||
cr.code = big_uint16_to_native(&b[0]);
|
||||
cb.consume(2);
|
||||
n -= 2;
|
||||
@@ -280,7 +278,8 @@ read_close(
|
||||
if(n > 0)
|
||||
{
|
||||
cr.reason.resize(n);
|
||||
net::buffer_copy(buffer(&cr.reason[0], n), cb);
|
||||
net::buffer_copy(
|
||||
net::buffer(&cr.reason[0], n), cb);
|
||||
if(! check_utf8(
|
||||
cr.reason.data(), cr.reason.size()))
|
||||
{
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_STREAM_BASE_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_DETAIL_STREAM_BASE_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/empty_body.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
@@ -88,7 +89,6 @@ struct impl_base<true>
|
||||
std::size_t& total_in,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer;
|
||||
BOOST_ASSERT(out.size() >= 6);
|
||||
auto& zo = this->pmd_->zo;
|
||||
zlib::z_params zs;
|
||||
@@ -123,7 +123,6 @@ struct impl_base<true>
|
||||
cb.consume(zs.total_in);
|
||||
if(zs.avail_out > 0 && fin)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const remain = buffer_size(cb);
|
||||
if(remain == 0)
|
||||
{
|
||||
@@ -144,13 +143,13 @@ struct impl_base<true>
|
||||
BOOST_ASSERT(! ec);
|
||||
// remove flush marker
|
||||
zs.total_out -= 4;
|
||||
out = buffer(out.data(), zs.total_out);
|
||||
out = net::buffer(out.data(), zs.total_out);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
ec = {};
|
||||
out = buffer(out.data(), zs.total_out);
|
||||
out = net::buffer(out.data(), zs.total_out);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP
|
||||
#define BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/websocket/detail/type_traits.hpp>
|
||||
#include <boost/beast/http/empty_body.hpp>
|
||||
#include <boost/beast/http/parser.hpp>
|
||||
@@ -122,7 +123,6 @@ public:
|
||||
void run(Buffers const& buffers)
|
||||
{
|
||||
error_code ec;
|
||||
using net::buffer_size;
|
||||
auto const mb = beast::detail::dynamic_buffer_prepare(
|
||||
ws_.impl_->rd_buf, buffer_size(buffers), ec,
|
||||
error::buffer_overflow);
|
||||
@@ -296,7 +296,6 @@ accept(
|
||||
ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
impl_->reset();
|
||||
using net::buffer_size;
|
||||
auto const mb = beast::detail::dynamic_buffer_prepare(
|
||||
impl_->rd_buf, buffer_size(buffers), ec,
|
||||
error::buffer_overflow);
|
||||
@@ -327,7 +326,6 @@ accept_ex(
|
||||
ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
impl_->reset();
|
||||
using net::buffer_size;
|
||||
auto const mb = beast::detail::dynamic_buffer_prepare(
|
||||
impl_->rd_buf, buffer_size(buffers), ec,
|
||||
error::buffer_overflow);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_READ_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_IMPL_READ_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/websocket/teardown.hpp>
|
||||
#include <boost/beast/websocket/detail/mask.hpp>
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
@@ -82,8 +83,6 @@ public:
|
||||
bool cont = true)
|
||||
{
|
||||
using beast::detail::clamp;
|
||||
using net::buffer;
|
||||
using net::buffer_size;
|
||||
auto& impl = *ws_.impl_;
|
||||
cont_ = cont;
|
||||
BOOST_ASIO_CORO_REENTER(*this)
|
||||
@@ -881,8 +880,6 @@ read_some(
|
||||
MutableBufferSequence>::value,
|
||||
"MutableBufferSequence requirements not met");
|
||||
using beast::detail::clamp;
|
||||
using net::buffer;
|
||||
using net::buffer_size;
|
||||
close_code code{};
|
||||
std::size_t bytes_written = 0;
|
||||
ec = {};
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_STREAM_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_IMPL_STREAM_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/websocket/rfc6455.hpp>
|
||||
#include <boost/beast/websocket/teardown.hpp>
|
||||
#include <boost/beast/websocket/detail/hybi13.hpp>
|
||||
@@ -282,7 +283,6 @@ parse_fh(
|
||||
DynamicBuffer& b,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
if(buffer_size(b.data()) < 2)
|
||||
{
|
||||
// need more bytes
|
||||
|
@@ -57,7 +57,6 @@ public:
|
||||
error_code ec = {},
|
||||
std::size_t bytes_transferred = 0)
|
||||
{
|
||||
using net::buffer;
|
||||
using tcp = net::ip::tcp;
|
||||
BOOST_ASIO_CORO_REENTER(*this)
|
||||
{
|
||||
@@ -130,7 +129,6 @@ teardown(
|
||||
net::ip::tcp::socket& socket,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer;
|
||||
if(role == role_type::server)
|
||||
socket.shutdown(
|
||||
net::ip::tcp::socket::shutdown_send, ec);
|
||||
@@ -140,7 +138,7 @@ teardown(
|
||||
{
|
||||
char buf[2048];
|
||||
auto const bytes_transferred =
|
||||
socket.read_some(buffer(buf), ec);
|
||||
socket.read_some(net::buffer(buf), ec);
|
||||
if(ec)
|
||||
{
|
||||
if(ec != net::error::eof)
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <boost/beast/websocket/detail/mask.hpp>
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
@@ -88,7 +89,6 @@ operator()(
|
||||
bool cont)
|
||||
{
|
||||
using beast::detail::clamp;
|
||||
using net::buffer_size;
|
||||
enum
|
||||
{
|
||||
do_nomask_nofrag,
|
||||
@@ -470,7 +470,6 @@ write_some(bool fin,
|
||||
ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
using beast::detail::clamp;
|
||||
using net::buffer_size;
|
||||
std::size_t bytes_transferred = 0;
|
||||
ec = {};
|
||||
// Make sure the stream is open
|
||||
|
@@ -31,6 +31,7 @@ add_executable (tests-beast-core
|
||||
async_op_base.cpp
|
||||
basic_timeout_stream.cpp
|
||||
bind_handler.cpp
|
||||
buffer_size.cpp
|
||||
buffer_traits.cpp
|
||||
buffered_read_stream.cpp
|
||||
buffers_adapter.cpp
|
||||
|
@@ -19,6 +19,7 @@ local SOURCES =
|
||||
async_op_base.cpp
|
||||
basic_timeout_stream.cpp
|
||||
bind_handler.cpp
|
||||
buffer_size.cpp
|
||||
buffer_traits.cpp
|
||||
buffered_read_stream.cpp
|
||||
buffers_adapter.cpp
|
||||
|
98
test/beast/core/buffer_size.cpp
Normal file
98
test/beast/core/buffer_size.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// Copyright (c) 2018 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
namespace {
|
||||
|
||||
struct sequence
|
||||
{
|
||||
struct value_type
|
||||
{
|
||||
operator net::const_buffer() const noexcept
|
||||
{
|
||||
return {"Hello, world!", 13};
|
||||
}
|
||||
};
|
||||
|
||||
using const_iterator = value_type const*;
|
||||
|
||||
const_iterator begin() const noexcept
|
||||
{
|
||||
return &v_;
|
||||
}
|
||||
|
||||
const_iterator end() const noexcept
|
||||
{
|
||||
return begin() + 1;
|
||||
}
|
||||
|
||||
private:
|
||||
value_type v_;
|
||||
};
|
||||
|
||||
struct not_sequence
|
||||
{
|
||||
};
|
||||
|
||||
} // (anon)
|
||||
|
||||
class buffer_size_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
void
|
||||
testJavadocs()
|
||||
{
|
||||
pass();
|
||||
}
|
||||
|
||||
void
|
||||
testFunction()
|
||||
{
|
||||
BEAST_EXPECT(buffer_size(
|
||||
net::const_buffer("Hello, world!", 13)) == 13);
|
||||
|
||||
BEAST_EXPECT(buffer_size(
|
||||
net::mutable_buffer{}) == 0);
|
||||
|
||||
{
|
||||
sequence s;
|
||||
BEAST_EXPECT(buffer_size(s) == 13);
|
||||
}
|
||||
|
||||
{
|
||||
std::array<net::const_buffer, 2> s({{
|
||||
net::const_buffer("Hello, world!", 13),
|
||||
net::const_buffer("Hello, world!", 13)}});
|
||||
BEAST_EXPECT(buffer_size(s) == 26);
|
||||
}
|
||||
|
||||
BOOST_STATIC_ASSERT(! detail::is_invocable<
|
||||
detail::buffer_size_impl,
|
||||
std::size_t(not_sequence const&)>::value);
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
testFunction();
|
||||
testJavadocs();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(beast,core,buffer_size);
|
||||
|
||||
} // beast
|
||||
} // boost
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
@@ -116,7 +117,6 @@ void test_mutable_buffers(
|
||||
MutableBufferSequence const& b,
|
||||
net::mutable_buffer)
|
||||
{
|
||||
using net::buffer_size;
|
||||
string_view src = "Hello, world!";
|
||||
BOOST_ASSERT(buffer_size(b) <= src.size());
|
||||
if(src.size() > buffer_size(b))
|
||||
@@ -139,8 +139,6 @@ test_buffer_sequence(
|
||||
net::is_const_buffer_sequence<
|
||||
ConstBufferSequence>::value);
|
||||
|
||||
using net::buffer_size;
|
||||
|
||||
using iterator = decltype(
|
||||
net::buffer_sequence_begin(buffers));
|
||||
BEAST_EXPECT(sizeof(iterator) > 0);
|
||||
@@ -183,7 +181,6 @@ test_buffer_sequence(
|
||||
|
||||
// bidirectional
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const first =
|
||||
net::buffer_sequence_begin(buffers);
|
||||
auto const last =
|
||||
@@ -290,8 +287,6 @@ test_mutable_dynamic_buffer(
|
||||
MutableDynamicBuffer const& b0,
|
||||
std::true_type)
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
net::is_mutable_buffer_sequence<typename
|
||||
MutableDynamicBuffer::mutable_data_type>::value);
|
||||
@@ -372,8 +367,6 @@ void
|
||||
test_dynamic_buffer(
|
||||
DynamicBuffer const& b0)
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
net::is_dynamic_buffer<DynamicBuffer>::value);
|
||||
|
||||
|
@@ -80,7 +80,6 @@ public:
|
||||
void
|
||||
on_read(error_code ec, std::size_t)
|
||||
{
|
||||
using net::buffer;
|
||||
if(! ec)
|
||||
{
|
||||
suite_.expect(s_ ==
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
@@ -42,8 +43,6 @@ public:
|
||||
void
|
||||
testSpecial()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
char s1[13];
|
||||
buffers_triple tb1(s1, sizeof(s1));
|
||||
BEAST_EXPECT(buffer_size(tb1) == sizeof(s1));
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
@@ -155,8 +156,6 @@ public:
|
||||
void
|
||||
testEmpty()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
struct empty_sequence
|
||||
{
|
||||
using value_type = net::const_buffer;
|
||||
@@ -275,19 +274,14 @@ public:
|
||||
void
|
||||
testGccWarning1()
|
||||
{
|
||||
using boost::beast::buffers_cat;
|
||||
using boost::beast::buffers_suffix;
|
||||
using net::buffer;
|
||||
using net::const_buffer;
|
||||
|
||||
char out[64];
|
||||
std::array<const_buffer, 2> buffers{
|
||||
{buffer("Hello, "), buffer("world!")}};
|
||||
std::array<net::const_buffer, 2> buffers{
|
||||
{net::buffer("Hello, "), net::buffer("world!")}};
|
||||
std::size_t i = 3;
|
||||
buffers_suffix<std::array<const_buffer, 2>> cb(buffers);
|
||||
buffers_suffix<std::array<net::const_buffer, 2>> cb(buffers);
|
||||
cb.consume(i);
|
||||
net::buffer_copy(
|
||||
buffer(out),
|
||||
net::buffer(out),
|
||||
buffers_cat(cb, cb));
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
@@ -89,7 +90,6 @@ public:
|
||||
void
|
||||
testPrefixes()
|
||||
{
|
||||
using net::buffer_size;
|
||||
std::string s = "Hello, world";
|
||||
BEAST_EXPECT(s.size() == 12);
|
||||
for(std::size_t x = 1; x < 4; ++x) {
|
||||
@@ -118,8 +118,6 @@ public:
|
||||
|
||||
void testEmpty()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
auto pb0 = buffers_prefix(0, net::mutable_buffer{});
|
||||
BEAST_EXPECT(buffer_size(pb0) == 0);
|
||||
auto pb1 = buffers_prefix(1, net::mutable_buffer{});
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
@@ -80,7 +81,6 @@ public:
|
||||
|
||||
// empty sequence
|
||||
{
|
||||
using net::buffer_size;
|
||||
buffers_suffix<net::mutable_buffer> cb(
|
||||
net::mutable_buffer{});
|
||||
BEAST_EXPECT(buffer_size(cb) == 0);
|
||||
@@ -113,7 +113,6 @@ public:
|
||||
void
|
||||
testMatrix()
|
||||
{
|
||||
using net::buffer_size;
|
||||
char buf[12];
|
||||
std::string const s = "Hello, world";
|
||||
BEAST_EXPECT(s.size() == sizeof(buf));
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
@@ -40,8 +41,6 @@ public:
|
||||
void
|
||||
testMembers()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
string_view const s = "Hello, world!";
|
||||
|
||||
// flat_static_buffer_base
|
||||
|
@@ -9,7 +9,9 @@
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/make_printable.hpp>
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -25,7 +27,6 @@ public:
|
||||
void
|
||||
print (ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
std::cout <<
|
||||
"Buffer size: " << buffer_size(buffers) << " bytes\n"
|
||||
"Buffer data: '" << make_printable(buffers) << "'\n";
|
||||
@@ -40,8 +41,6 @@ public:
|
||||
void
|
||||
testMakePrintable()
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
char buf[13];
|
||||
buffers_triple b(buf, sizeof(buf));
|
||||
string_view src = "Hello, world!";
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
@@ -577,8 +578,6 @@ public:
|
||||
void
|
||||
testMatrix1()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
string_view s = "Hello, world";
|
||||
BEAST_EXPECT(s.size() == 12);
|
||||
for(std::size_t i = 1; i < 12; ++i) {
|
||||
@@ -621,8 +620,6 @@ public:
|
||||
testMatrix2()
|
||||
{
|
||||
using namespace test;
|
||||
using net::buffer;
|
||||
using net::buffer_size;
|
||||
std::string const s = "Hello, world";
|
||||
BEAST_EXPECT(s.size() == 12);
|
||||
for(std::size_t i = 1; i < 12; ++i) {
|
||||
@@ -649,7 +646,7 @@ public:
|
||||
{
|
||||
auto d = b.prepare(x);
|
||||
BEAST_EXPECT(buffer_size(d) == x);
|
||||
b.commit(buffer_copy(d, buffer(s.data(), x)));
|
||||
b.commit(buffer_copy(d, net::buffer(s.data(), x)));
|
||||
}
|
||||
BEAST_EXPECT(b.size() == x);
|
||||
BEAST_EXPECT(buffer_size(b.data()) == b.size());
|
||||
@@ -668,7 +665,7 @@ public:
|
||||
{
|
||||
auto d = b.prepare(y);
|
||||
BEAST_EXPECT(buffer_size(d) == y);
|
||||
b.commit(buffer_copy(d, buffer(s.data()+x, y)));
|
||||
b.commit(buffer_copy(d, net::buffer(s.data()+x, y)));
|
||||
}
|
||||
b.commit(1);
|
||||
BEAST_EXPECT(b.size() == x + y);
|
||||
@@ -688,7 +685,7 @@ public:
|
||||
{
|
||||
auto d = b.prepare(z);
|
||||
BEAST_EXPECT(buffer_size(d) == z);
|
||||
b.commit(buffer_copy(d, buffer(s.data()+x+y, z)));
|
||||
b.commit(buffer_copy(d, net::buffer(s.data()+x+y, z)));
|
||||
}
|
||||
b.commit(2);
|
||||
BEAST_EXPECT(b.size() == x + y + z);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "buffer_test.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
@@ -44,8 +45,6 @@ public:
|
||||
void
|
||||
testMembers()
|
||||
{
|
||||
using net::buffer_size;
|
||||
|
||||
string_view const s = "Hello, world!";
|
||||
|
||||
// static_buffer_base
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "message_fuzz.hpp"
|
||||
#include "test_parser.hpp"
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
@@ -156,7 +157,6 @@ public:
|
||||
parsegrind(ConstBufferSequence const& buffers,
|
||||
Test const& test, bool skip = false)
|
||||
{
|
||||
using net::buffer_size;
|
||||
auto const size = buffer_size(buffers);
|
||||
for(std::size_t i = 1; i < size - 1; ++i)
|
||||
{
|
||||
|
@@ -10,6 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/http/file_body.hpp>
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/file_stdio.hpp>
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
@@ -33,7 +34,6 @@ public:
|
||||
void
|
||||
operator()(error_code&, ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
buffer.commit(net::buffer_copy(
|
||||
buffer.prepare(buffer_size(buffers)),
|
||||
buffers));
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/test/yield_to.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
@@ -51,7 +52,6 @@ public:
|
||||
basic_parser<isRequest, Derived>& p,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
buffers_suffix<ConstBufferSequence> cb{buffers};
|
||||
for(;;)
|
||||
{
|
||||
@@ -75,13 +75,12 @@ public:
|
||||
void
|
||||
doMatrix(string_view s0, F const& f)
|
||||
{
|
||||
using net::buffer;
|
||||
// parse a single buffer
|
||||
{
|
||||
auto s = s0;
|
||||
error_code ec;
|
||||
parser_type<isRequest> p;
|
||||
put(buffer(s.data(), s.size()), p, ec);
|
||||
put(net::buffer(s.data(), s.size()), p, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
f(p);
|
||||
@@ -94,7 +93,7 @@ public:
|
||||
parser_type<isRequest> p;
|
||||
p.eager(true);
|
||||
auto used =
|
||||
p.put(buffer(s.data(), n), ec);
|
||||
p.put(net::buffer(s.data(), n), ec);
|
||||
s.remove_prefix(used);
|
||||
if(ec == error::need_more)
|
||||
ec = {};
|
||||
@@ -102,7 +101,7 @@ public:
|
||||
continue;
|
||||
BEAST_EXPECT(! p.is_done());
|
||||
used = p.put(
|
||||
buffer(s.data(), s.size()), ec);
|
||||
net::buffer(s.data(), s.size()), ec);
|
||||
s.remove_prefix(used);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
continue;
|
||||
|
@@ -430,7 +430,6 @@ public:
|
||||
void
|
||||
readgrind(string_view s, Pred&& pred)
|
||||
{
|
||||
using net::buffer;
|
||||
for(std::size_t n = 1; n < s.size() - 1; ++n)
|
||||
{
|
||||
Parser p;
|
||||
|
@@ -10,6 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/http/serializer.hpp>
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
@@ -91,7 +92,6 @@ public:
|
||||
operator()(error_code&,
|
||||
ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
size = buffer_size(buffers);
|
||||
}
|
||||
};
|
||||
|
@@ -10,6 +10,7 @@
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/http/span_body.hpp>
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
@@ -23,7 +24,6 @@ struct span_body_test
|
||||
void
|
||||
testSpanBody()
|
||||
{
|
||||
using net::buffer_size;
|
||||
{
|
||||
using B = span_body<char const>;
|
||||
request<B> req;
|
||||
|
@@ -124,10 +124,10 @@ public:
|
||||
std::false_type, // isSplit
|
||||
std::false_type) // isFinalEmpty
|
||||
{
|
||||
using net::buffer;
|
||||
if(body_.s.empty())
|
||||
return boost::none;
|
||||
return {{buffer(body_.s.data(), body_.s.size()), false}};
|
||||
return {{net::buffer(
|
||||
body_.s.data(), body_.s.size()), false}};
|
||||
}
|
||||
|
||||
boost::optional<std::pair<const_buffers_type, bool>>
|
||||
@@ -135,14 +135,13 @@ public:
|
||||
std::false_type, // isSplit
|
||||
std::true_type) // isFinalEmpty
|
||||
{
|
||||
using net::buffer;
|
||||
if(body_.s.empty())
|
||||
return boost::none;
|
||||
switch(step_)
|
||||
{
|
||||
case 0:
|
||||
step_ = 1;
|
||||
return {{buffer(
|
||||
return {{net::buffer(
|
||||
body_.s.data(), body_.s.size()), true}};
|
||||
default:
|
||||
return boost::none;
|
||||
@@ -154,7 +153,6 @@ public:
|
||||
std::true_type, // isSplit
|
||||
std::false_type) // isFinalEmpty
|
||||
{
|
||||
using net::buffer;
|
||||
auto const n = (body_.s.size() + 1) / 2;
|
||||
switch(step_)
|
||||
{
|
||||
@@ -162,10 +160,10 @@ public:
|
||||
if(n == 0)
|
||||
return boost::none;
|
||||
step_ = 1;
|
||||
return {{buffer(body_.s.data(), n),
|
||||
return {{net::buffer(body_.s.data(), n),
|
||||
body_.s.size() > 1}};
|
||||
default:
|
||||
return {{buffer(body_.s.data() + n,
|
||||
return {{net::buffer(body_.s.data() + n,
|
||||
body_.s.size() - n), false}};
|
||||
}
|
||||
}
|
||||
@@ -175,7 +173,6 @@ public:
|
||||
std::true_type, // isSplit
|
||||
std::true_type) // isFinalEmpty
|
||||
{
|
||||
using net::buffer;
|
||||
auto const n = (body_.s.size() + 1) / 2;
|
||||
switch(step_)
|
||||
{
|
||||
@@ -183,11 +180,11 @@ public:
|
||||
if(n == 0)
|
||||
return boost::none;
|
||||
step_ = body_.s.size() > 1 ? 1 : 2;
|
||||
return {{buffer(body_.s.data(), n), true}};
|
||||
return {{net::buffer(body_.s.data(), n), true}};
|
||||
case 1:
|
||||
BOOST_ASSERT(body_.s.size() > 1);
|
||||
step_ = 2;
|
||||
return {{buffer(body_.s.data() + n,
|
||||
return {{net::buffer(body_.s.data() + n,
|
||||
body_.s.size() - n), true}};
|
||||
default:
|
||||
return boost::none;
|
||||
|
@@ -171,8 +171,6 @@ public:
|
||||
void
|
||||
testSuspend()
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
// suspend on ping
|
||||
doFailLoop([&](test::fail_count& fc)
|
||||
{
|
||||
@@ -374,7 +372,7 @@ public:
|
||||
"\x88\x00", 2});
|
||||
std::size_t count = 0;
|
||||
std::string const s = "Hello, world!";
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
if(ec)
|
||||
@@ -419,7 +417,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
multi_buffer b;
|
||||
std::string const s = "Hello, world!";
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
if(ec)
|
||||
@@ -479,7 +477,7 @@ public:
|
||||
system_error{ec});
|
||||
++count;
|
||||
});
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t)
|
||||
{
|
||||
if(ec != net::error::operation_aborted)
|
||||
@@ -527,7 +525,7 @@ public:
|
||||
BEAST_EXPECT(
|
||||
ec == net::error::operation_aborted);
|
||||
});
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
if(ec)
|
||||
@@ -588,7 +586,7 @@ public:
|
||||
system_error{ec});
|
||||
++count;
|
||||
});
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t)
|
||||
{
|
||||
if(ec != net::error::operation_aborted)
|
||||
|
@@ -75,8 +75,6 @@ public:
|
||||
void
|
||||
doTestRead(Wrap const& w)
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
permessage_deflate pmd;
|
||||
pmd.client_enable = false;
|
||||
pmd.server_enable = false;
|
||||
@@ -230,7 +228,7 @@ public:
|
||||
std::string const s(2000, '*');
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -285,7 +283,7 @@ public:
|
||||
std::string const s = "Hello, world!";
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
try
|
||||
{
|
||||
multi_buffer b(3);
|
||||
@@ -306,7 +304,7 @@ public:
|
||||
auto const s = std::string(2000, '*') +
|
||||
random_string();
|
||||
ws.text(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
doReadTest(w, ws, close_code::bad_payload);
|
||||
});
|
||||
|
||||
@@ -363,7 +361,7 @@ public:
|
||||
{
|
||||
std::string const s =
|
||||
"Hello, world!" "\xc0";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
doReadTest(w, ws, close_code::bad_payload);
|
||||
});
|
||||
|
||||
@@ -437,8 +435,6 @@ public:
|
||||
void
|
||||
doTestReadDeflate(Wrap const& w)
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
permessage_deflate pmd;
|
||||
pmd.client_enable = true;
|
||||
pmd.server_enable = true;
|
||||
@@ -451,7 +447,7 @@ public:
|
||||
[&](ws_type_t<true>& ws)
|
||||
{
|
||||
std::string const s = std::string(128, '*');
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
ws.read_message_max(32);
|
||||
doFailTest(w, ws, error::message_too_big);
|
||||
});
|
||||
@@ -490,7 +486,7 @@ public:
|
||||
{
|
||||
auto const& s = random_string();
|
||||
ws.binary(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -504,15 +500,13 @@ public:
|
||||
permessage_deflate const& pmd,
|
||||
Wrap const& w)
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
// message
|
||||
doTest(pmd, [&](ws_type& ws)
|
||||
{
|
||||
std::string const s = "Hello, world!";
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -533,7 +527,7 @@ public:
|
||||
std::string const s = "Hello, world!";
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -552,7 +546,7 @@ public:
|
||||
{
|
||||
std::string const s = "";
|
||||
ws.text(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -563,10 +557,10 @@ public:
|
||||
doTest(pmd, [&](ws_type& ws)
|
||||
{
|
||||
std::string const s = "Hello";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
char buf[3];
|
||||
auto const bytes_written =
|
||||
w.read_some(ws, buffer(buf, sizeof(buf)));
|
||||
w.read_some(ws, net::buffer(buf, sizeof(buf)));
|
||||
BEAST_EXPECT(bytes_written > 0);
|
||||
BEAST_EXPECT(
|
||||
string_view(buf, 3).substr(0, bytes_written) ==
|
||||
@@ -577,7 +571,7 @@ public:
|
||||
doTest(pmd, [&](ws_type& ws)
|
||||
{
|
||||
std::string const s = "Hello, world!";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
auto bytes_written =
|
||||
w.read_some(ws, 3, b);
|
||||
@@ -593,7 +587,7 @@ public:
|
||||
{
|
||||
auto const& s = random_string();
|
||||
ws.binary(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -605,7 +599,7 @@ public:
|
||||
std::string const s = "\x03\xea\xf0\x28\x8c\xbc";
|
||||
ws.auto_fragment(false);
|
||||
ws.text(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
doReadTest(w, ws, close_code::bad_payload);
|
||||
});
|
||||
}
|
||||
@@ -613,8 +607,6 @@ public:
|
||||
void
|
||||
testRead()
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
doTestRead<false>(SyncClient{});
|
||||
doTestRead<true>(SyncClient{});
|
||||
doTestReadDeflate(SyncClient{});
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/strand.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
@@ -26,8 +27,6 @@ public:
|
||||
void
|
||||
testSuspend()
|
||||
{
|
||||
using net::buffer;
|
||||
#if 1
|
||||
// suspend on read block
|
||||
doFailLoop([&](test::fail_count& fc)
|
||||
{
|
||||
@@ -59,12 +58,10 @@ public:
|
||||
ioc.run();
|
||||
BEAST_EXPECT(count == 2);
|
||||
});
|
||||
#endif
|
||||
|
||||
// suspend on release read block
|
||||
doFailLoop([&](test::fail_count& fc)
|
||||
{
|
||||
//log << "fc.count()==" << fc.count() << std::endl;
|
||||
echo_server es{log};
|
||||
net::io_context ioc;
|
||||
stream<test::stream> ws{ioc, fc};
|
||||
@@ -93,7 +90,6 @@ public:
|
||||
BEAST_EXPECT(count == 2);
|
||||
});
|
||||
|
||||
#if 1
|
||||
// suspend on write pong
|
||||
doFailLoop([&](test::fail_count& fc)
|
||||
{
|
||||
@@ -118,7 +114,7 @@ public:
|
||||
++count;
|
||||
});
|
||||
BEAST_EXPECT(ws.impl_->rd_block.is_locked());
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
if(ec)
|
||||
@@ -217,7 +213,6 @@ public:
|
||||
ioc.run();
|
||||
BEAST_EXPECT(count == 2);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#ifndef BEAST_TEST_WEBSOCKET_TEST_HPP
|
||||
#define BEAST_TEST_WEBSOCKET_TEST_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
@@ -434,7 +435,6 @@ public:
|
||||
DynamicBuffer& buffer,
|
||||
ConstBufferSequence const& buffers)
|
||||
{
|
||||
using net::buffer_size;
|
||||
buffer.commit(net::buffer_copy(
|
||||
buffer.prepare(buffer_size(buffers)),
|
||||
buffers));
|
||||
|
@@ -26,8 +26,6 @@ public:
|
||||
void
|
||||
doTestWrite(Wrap const& w)
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
permessage_deflate pmd;
|
||||
pmd.client_enable = false;
|
||||
pmd.server_enable = false;
|
||||
@@ -59,7 +57,7 @@ public:
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
std::string const s = "Hello, world!";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -85,8 +83,8 @@ public:
|
||||
ws.auto_fragment(false);
|
||||
ws.binary(false);
|
||||
std::string const s = "Hello, world!";
|
||||
w.write_some(ws, false, buffer(s.data(), 5));
|
||||
w.write_some(ws, true, buffer(s.data() + 5, s.size() - 5));
|
||||
w.write_some(ws, false, net::buffer(s.data(), 5));
|
||||
w.write_some(ws, true, net::buffer(s.data() + 5, s.size() - 5));
|
||||
multi_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(ws.got_text());
|
||||
@@ -101,8 +99,8 @@ public:
|
||||
std::size_t const chop = 3;
|
||||
BOOST_ASSERT(chop < s.size());
|
||||
w.write_some(ws, false,
|
||||
buffer(s.data(), chop));
|
||||
w.write_some(ws, true, buffer(
|
||||
net::buffer(s.data(), chop));
|
||||
w.write_some(ws, true, net::buffer(
|
||||
s.data() + chop, s.size() - chop));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
@@ -115,7 +113,7 @@ public:
|
||||
{
|
||||
ws.auto_fragment(false);
|
||||
std::string const s = "Hello";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -128,7 +126,7 @@ public:
|
||||
ws.auto_fragment(false);
|
||||
ws.write_buffer_size(16);
|
||||
std::string const s(32, '*');
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -140,7 +138,7 @@ public:
|
||||
{
|
||||
ws.auto_fragment(true);
|
||||
std::string const s(16384, '*');
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -158,7 +156,7 @@ public:
|
||||
w.accept(ws);
|
||||
ws.auto_fragment(false);
|
||||
std::string const s = "Hello";
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -184,7 +182,7 @@ public:
|
||||
w.accept(ws);
|
||||
ws.auto_fragment(true);
|
||||
std::string const s(16384, '*');
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -203,8 +201,6 @@ public:
|
||||
void
|
||||
doTestWriteDeflate(Wrap const& w)
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
permessage_deflate pmd;
|
||||
pmd.client_enable = true;
|
||||
pmd.server_enable = true;
|
||||
@@ -215,7 +211,7 @@ public:
|
||||
{
|
||||
auto const& s = random_string();
|
||||
ws.binary(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -230,8 +226,8 @@ public:
|
||||
// This call should produce no
|
||||
// output due to compression latency.
|
||||
w.write_some(ws, false,
|
||||
buffer(s.data(), chop));
|
||||
w.write_some(ws, true, buffer(
|
||||
net::buffer(s.data(), chop));
|
||||
w.write_some(ws, true, net::buffer(
|
||||
s.data() + chop, s.size() - chop));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
@@ -244,7 +240,7 @@ public:
|
||||
{
|
||||
auto const& s = random_string();
|
||||
ws.binary(true);
|
||||
w.write(ws, buffer(s));
|
||||
w.write(ws, net::buffer(s));
|
||||
flat_buffer b;
|
||||
w.read(ws, b);
|
||||
BEAST_EXPECT(buffers_to_string(b.data()) == s);
|
||||
@@ -254,8 +250,6 @@ public:
|
||||
void
|
||||
testWrite()
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
doTestWrite<false>(SyncClient{});
|
||||
doTestWrite<true>(SyncClient{});
|
||||
doTestWriteDeflate(SyncClient{});
|
||||
@@ -271,8 +265,6 @@ public:
|
||||
void
|
||||
testWriteSuspend()
|
||||
{
|
||||
using net::buffer;
|
||||
|
||||
// suspend on ping
|
||||
doFailLoop([&](test::fail_count& fc)
|
||||
{
|
||||
@@ -392,7 +384,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
std::string const s(16384, '*');
|
||||
ws.auto_fragment(false);
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
++count;
|
||||
@@ -426,7 +418,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
std::string const s(16384, '*');
|
||||
ws.auto_fragment(true);
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
++count;
|
||||
@@ -459,7 +451,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
std::string const s(16384, '*');
|
||||
ws.auto_fragment(false);
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
++count;
|
||||
@@ -491,7 +483,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
std::string const s(16384, '*');
|
||||
ws.auto_fragment(true);
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
++count;
|
||||
@@ -529,7 +521,7 @@ public:
|
||||
std::size_t count = 0;
|
||||
auto const& s = random_string();
|
||||
ws.binary(true);
|
||||
ws.async_write(buffer(s),
|
||||
ws.async_write(net::buffer(s),
|
||||
[&](error_code ec, std::size_t n)
|
||||
{
|
||||
++count;
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "test/beast/http/message_fuzz.hpp"
|
||||
|
||||
#include <boost/beast/http.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
@@ -76,7 +77,6 @@ public:
|
||||
basic_parser<isRequest, Derived>& parser,
|
||||
error_code& ec)
|
||||
{
|
||||
using net::buffer_size;
|
||||
beast::buffers_suffix<
|
||||
ConstBufferSequence> cb{buffers};
|
||||
std::size_t used = 0;
|
||||
|
@@ -115,7 +115,7 @@ class connection
|
||||
test_buffer const& tb_;
|
||||
net::strand<
|
||||
net::io_context::executor_type> strand_;
|
||||
boost::beast::multi_buffer buffer_;
|
||||
beast::multi_buffer buffer_;
|
||||
std::mt19937_64 rng_;
|
||||
std::size_t count_ = 0;
|
||||
std::size_t bytes_ = 0;
|
||||
@@ -187,11 +187,10 @@ private:
|
||||
void
|
||||
do_write()
|
||||
{
|
||||
using net::buffer_size;
|
||||
std::geometric_distribution<std::size_t> dist{
|
||||
double(4) / buffer_size(tb_)};
|
||||
double(4) / beast::buffer_size(tb_)};
|
||||
ws_.async_write_some(true,
|
||||
boost::beast::buffers_prefix(dist(rng_), tb_),
|
||||
beast::buffers_prefix(dist(rng_), tb_),
|
||||
alloc_.wrap(std::bind(
|
||||
&connection::on_write,
|
||||
shared_from_this(),
|
||||
@@ -281,7 +280,7 @@ throughput(
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
boost::beast::unit_test::dstream dout(std::cerr);
|
||||
beast::unit_test::dstream dout(std::cerr);
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -95,8 +95,7 @@ std::string string_from_buffers (ConstBufferSequence const& buffers)
|
||||
|
||||
// optimization: reserve all the space for the string first
|
||||
std::string result;
|
||||
using net::buffer_size; // buffer_size is a customization point,
|
||||
result.reserve(buffer_size(buffers)); // called without namespace qualification
|
||||
result.reserve(beast::buffer_size(buffers)); // beast version of net::buffer_size
|
||||
|
||||
// iterate over each buffer in the sequence and append it to the string
|
||||
for(auto it = net::buffer_sequence_begin(buffers); // returns an iterator to beginning of the sequence
|
||||
|
@@ -7,6 +7,7 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/file_base.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
@@ -164,7 +165,6 @@ struct BodyReader
|
||||
// The specification requires this to indicate "no error"
|
||||
ec = {};
|
||||
|
||||
using net::buffer_size;
|
||||
return buffer_size(buffers);
|
||||
}
|
||||
|
||||
|
@@ -272,7 +272,6 @@ void fxx() {
|
||||
auto const cb3 = get_next_chunk_body();
|
||||
|
||||
// Manually emit a chunk by first writing the chunk-size header with the correct size
|
||||
using net::buffer_size;
|
||||
net::write(sock, chunk_header{
|
||||
buffer_size(cb1) +
|
||||
buffer_size(cb2) +
|
||||
@@ -368,7 +367,6 @@ print_cxx14(message<isRequest, Body, Fields> const& m)
|
||||
{
|
||||
ec = {};
|
||||
std::cout << buffers(buffer);
|
||||
using net::buffer_size;
|
||||
sr.consume(buffer_size(buffer));
|
||||
});
|
||||
}
|
||||
@@ -396,7 +394,6 @@ struct lambda
|
||||
{
|
||||
ec = {};
|
||||
std::cout << buffers(buffer);
|
||||
using net::buffer_size;
|
||||
sr.consume(buffer_size(buffer));
|
||||
}
|
||||
};
|
||||
@@ -438,7 +435,6 @@ split_print_cxx14(message<isRequest, Body, Fields> const& m)
|
||||
{
|
||||
ec = {};
|
||||
std::cout << buffers(buffer);
|
||||
using net::buffer_size;
|
||||
sr.consume(buffer_size(buffer));
|
||||
});
|
||||
}
|
||||
@@ -453,7 +449,6 @@ split_print_cxx14(message<isRequest, Body, Fields> const& m)
|
||||
{
|
||||
ec = {};
|
||||
std::cout << buffers(buffer);
|
||||
using net::buffer_size;
|
||||
sr.consume(buffer_size(buffer));
|
||||
});
|
||||
}
|
||||
|
@@ -202,7 +202,6 @@ boost::ignore_unused(ec);
|
||||
// This will cause the message to be broken up into multiple frames.
|
||||
for(;;)
|
||||
{
|
||||
using net::buffer_size;
|
||||
if(buffer_size(cb) > 512)
|
||||
{
|
||||
// There are more than 512 bytes left to send, just
|
||||
|
Reference in New Issue
Block a user