forked from boostorg/beast
Remove handler helpers, tidy up hook invocations (API Change)
This commit is contained in:
@@ -13,8 +13,8 @@ API Changes
|
|||||||
|
|
||||||
* Return http::error::end_of_stream on HTTP read eof
|
* Return http::error::end_of_stream on HTTP read eof
|
||||||
* Remove placeholders
|
* Remove placeholders
|
||||||
* Move prepare_buffers to prepare_buffer.hpp
|
|
||||||
* Rename prepare_buffer(s) to buffer_prefix
|
* Rename prepare_buffer(s) to buffer_prefix
|
||||||
|
* Remove handler helpers, tidy up hook invocations
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
47
doc/core.qbk
47
doc/core.qbk
@@ -294,53 +294,6 @@ the associated asynchronous initiation functions used to launch them.
|
|||||||
]]
|
]]
|
||||||
]
|
]
|
||||||
|
|
||||||
When implementing composed operations it is necessary to provide hooks for
|
|
||||||
the composed operation which forward the hook calls to the hooks associated
|
|
||||||
with the final completion handler. These calls must be made from a namespace
|
|
||||||
that does not include overloads of the hook functions, since they depend on
|
|
||||||
argument dependent lookup to resolve. Beast provides a set of public helper
|
|
||||||
functions to invoke these hooks. These hooks are all located in the
|
|
||||||
`beast_asio_helpers` namespace rather than the `beast` namespace:
|
|
||||||
|
|
||||||
[table Handler Hooks
|
|
||||||
[[Name][Description]]
|
|
||||||
[[
|
|
||||||
[link beast.ref.beast_asio_helpers__allocate `allocate`]
|
|
||||||
][
|
|
||||||
Allocation function for a handler. Asynchronous operations may need to
|
|
||||||
allocate temporary objects. Since asynchronous operations have a handler
|
|
||||||
function object, these temporary objects can be said to be associated with
|
|
||||||
the handler.
|
|
||||||
]]
|
|
||||||
[[
|
|
||||||
[link beast.ref.beast_asio_helpers__deallocate `deallocate`]
|
|
||||||
][
|
|
||||||
Deallocation function for a handler. The implementation guarantees that
|
|
||||||
the deallocation will occur before the associated handler is invoked, which
|
|
||||||
means the memory is ready to be reused for any new asynchronous operations
|
|
||||||
started by the handler.
|
|
||||||
]]
|
|
||||||
[[
|
|
||||||
[link beast.ref.beast_asio_helpers__invoke `invoke`]
|
|
||||||
][
|
|
||||||
Invocation function for a handler. When asynchronous operations are
|
|
||||||
composed from other asynchronous operations, all intermediate handlers
|
|
||||||
should be invoked using the same method as the final handler. This is
|
|
||||||
required to ensure that user-defined objects are not accessed in a way
|
|
||||||
that may violate the guarantees. This hooking function ensures that the
|
|
||||||
invoked method used for the final handler is accessible at each
|
|
||||||
intermediate step.
|
|
||||||
]]
|
|
||||||
[[
|
|
||||||
[link beast.ref.beast_asio_helpers__is_continuation `is_continuation`]
|
|
||||||
][
|
|
||||||
Continuation function for a handler. Asynchronous operations may represent
|
|
||||||
a continuation of the asynchronous control flow associated with the current
|
|
||||||
handler. The implementation can use this knowledge to optimise scheduling
|
|
||||||
of the handler.
|
|
||||||
]]
|
|
||||||
]
|
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
|
||||||
|
@@ -207,13 +207,6 @@
|
|||||||
</simplelist>
|
</simplelist>
|
||||||
</entry>
|
</entry>
|
||||||
<entry valign="top">
|
<entry valign="top">
|
||||||
<bridgehead renderas="sect3">Helpers</bridgehead>
|
|
||||||
<simplelist type="vert" columns="1">
|
|
||||||
<member><link linkend="beast.ref.beast_asio_helpers__allocate">allocate</link></member>
|
|
||||||
<member><link linkend="beast.ref.beast_asio_helpers__deallocate">deallocate</link></member>
|
|
||||||
<member><link linkend="beast.ref.beast_asio_helpers__invoke">invoke</link></member>
|
|
||||||
<member><link linkend="beast.ref.beast_asio_helpers__is_continuation">is_continuation</link></member>
|
|
||||||
</simplelist>
|
|
||||||
<bridgehead renderas="sect3">Concepts</bridgehead>
|
<bridgehead renderas="sect3">Concepts</bridgehead>
|
||||||
<simplelist type="vert" columns="1">
|
<simplelist type="vert" columns="1">
|
||||||
<member><link linkend="beast.ref.streams.AsyncStream">AsyncStream</link></member>
|
<member><link linkend="beast.ref.streams.AsyncStream">AsyncStream</link></member>
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "mime_type.hpp"
|
#include "mime_type.hpp"
|
||||||
|
|
||||||
#include <beast/http.hpp>
|
#include <beast/http.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/multi_buffer.hpp>
|
#include <beast/core/multi_buffer.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
@@ -98,11 +97,11 @@ private:
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
message<isRequest, Body, Fields>&& m_)
|
message<isRequest, Body, Fields>&& m_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, m(std::move(m_))
|
, m(std::move(m_))
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,16 +136,18 @@ private:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, write_op* op)
|
void* p, std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -159,8 +160,9 @@ private:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include <beast/core/error.hpp>
|
#include <beast/core/error.hpp>
|
||||||
#include <beast/core/flat_buffer.hpp>
|
#include <beast/core/flat_buffer.hpp>
|
||||||
#include <beast/core/handler_alloc.hpp>
|
#include <beast/core/handler_alloc.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/multi_buffer.hpp>
|
#include <beast/core/multi_buffer.hpp>
|
||||||
#include <beast/core/ostream.hpp>
|
#include <beast/core/ostream.hpp>
|
||||||
|
@@ -8,8 +8,10 @@
|
|||||||
#ifndef BEAST_BIND_DETAIL_HANDLER_HPP
|
#ifndef BEAST_BIND_DETAIL_HANDLER_HPP
|
||||||
#define BEAST_BIND_DETAIL_HANDLER_HPP
|
#define BEAST_BIND_DETAIL_HANDLER_HPP
|
||||||
|
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/detail/integer_sequence.hpp>
|
#include <beast/core/detail/integer_sequence.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -68,8 +70,9 @@ public:
|
|||||||
asio_handler_allocate(
|
asio_handler_allocate(
|
||||||
std::size_t size, bound_handler* h)
|
std::size_t size, bound_handler* h)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, h->h_);
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(h->h_));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -77,16 +80,17 @@ public:
|
|||||||
asio_handler_deallocate(
|
asio_handler_deallocate(
|
||||||
void* p, std::size_t size, bound_handler* h)
|
void* p, std::size_t size, bound_handler* h)
|
||||||
{
|
{
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, h->h_);
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(h->h_));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
bool
|
bool
|
||||||
asio_handler_is_continuation(bound_handler* h)
|
asio_handler_is_continuation(bound_handler* h)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_is_continuation;
|
||||||
is_continuation (h->h_);
|
return asio_handler_is_continuation(std::addressof(h->h_));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class F>
|
template<class F>
|
||||||
@@ -94,8 +98,9 @@ public:
|
|||||||
void
|
void
|
||||||
asio_handler_invoke(F&& f, bound_handler* h)
|
asio_handler_invoke(F&& f, bound_handler* h)
|
||||||
{
|
{
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, h->h_);
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(h->h_));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#define BEAST_HANDLER_ALLOC_HPP
|
#define BEAST_HANDLER_ALLOC_HPP
|
||||||
|
|
||||||
#include <beast/config.hpp>
|
#include <beast/config.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -92,17 +92,17 @@ public:
|
|||||||
allocate(std::ptrdiff_t n)
|
allocate(std::ptrdiff_t n)
|
||||||
{
|
{
|
||||||
auto const size = n * sizeof(T);
|
auto const size = n * sizeof(T);
|
||||||
|
using boost::asio::asio_handler_allocate;
|
||||||
return static_cast<value_type*>(
|
return static_cast<value_type*>(
|
||||||
beast_asio_helpers::allocate(
|
asio_handler_allocate(size, std::addressof(h_)));
|
||||||
size, h_));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
deallocate(value_type* p, std::ptrdiff_t n)
|
deallocate(value_type* p, std::ptrdiff_t n)
|
||||||
{
|
{
|
||||||
auto const size = n * sizeof(T);
|
auto const size = n * sizeof(T);
|
||||||
beast_asio_helpers::deallocate(
|
using boost::asio::asio_handler_deallocate;
|
||||||
p, size, h_);
|
asio_handler_deallocate(p, size, std::addressof(h_));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@@ -1,105 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright (c) 2013-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)
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef BEAST_HANDLER_HELPERS_HPP
|
|
||||||
#define BEAST_HANDLER_HELPERS_HPP
|
|
||||||
|
|
||||||
#include <beast/config.hpp>
|
|
||||||
#include <boost/asio/handler_alloc_hook.hpp>
|
|
||||||
#include <boost/asio/handler_continuation_hook.hpp>
|
|
||||||
#include <boost/asio/handler_invoke_hook.hpp>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
/* Calls to:
|
|
||||||
|
|
||||||
* asio_handler_allocate
|
|
||||||
* asio_handler_deallocate
|
|
||||||
* asio_handler_invoke
|
|
||||||
* asio_handler_is_continuation
|
|
||||||
|
|
||||||
must be made from a namespace that does not
|
|
||||||
contain overloads of this function. The beast_asio_helpers
|
|
||||||
namespace is defined here for that purpose.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace beast_asio_helpers {
|
|
||||||
|
|
||||||
/// Allocation function for handlers.
|
|
||||||
template <class Handler>
|
|
||||||
inline
|
|
||||||
void*
|
|
||||||
allocate(std::size_t s, Handler& handler)
|
|
||||||
{
|
|
||||||
#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
|
|
||||||
return ::operator new(s);
|
|
||||||
#else
|
|
||||||
using boost::asio::asio_handler_allocate;
|
|
||||||
return asio_handler_allocate(s, std::addressof(handler));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deallocation function for handlers.
|
|
||||||
template<class Handler>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
deallocate(void* p, std::size_t s, Handler& handler)
|
|
||||||
{
|
|
||||||
#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
|
|
||||||
::operator delete(p);
|
|
||||||
#else
|
|
||||||
using boost::asio::asio_handler_deallocate;
|
|
||||||
asio_handler_deallocate(p, s, std::addressof(handler));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Invoke function for handlers.
|
|
||||||
template<class Function, class Handler>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
invoke(Function& function, Handler& handler)
|
|
||||||
{
|
|
||||||
#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
|
|
||||||
Function tmp(function);
|
|
||||||
tmp();
|
|
||||||
#else
|
|
||||||
using boost::asio::asio_handler_invoke;
|
|
||||||
asio_handler_invoke(function, std::addressof(handler));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Invoke function for handlers.
|
|
||||||
template<class Function, class Handler>
|
|
||||||
inline
|
|
||||||
void
|
|
||||||
invoke(Function const& function, Handler& handler)
|
|
||||||
{
|
|
||||||
#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
|
|
||||||
Function tmp(function);
|
|
||||||
tmp();
|
|
||||||
#else
|
|
||||||
using boost::asio::asio_handler_invoke;
|
|
||||||
asio_handler_invoke(function, std::addressof(handler));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if handler represents a continuation of the asynchronous operation
|
|
||||||
template<class Handler>
|
|
||||||
inline
|
|
||||||
bool
|
|
||||||
is_continuation(Handler& handler)
|
|
||||||
{
|
|
||||||
#if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
using boost::asio::asio_handler_is_continuation;
|
|
||||||
return asio_handler_is_continuation(std::addressof(handler));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // beast_asio_helpers
|
|
||||||
|
|
||||||
#endif
|
|
@@ -10,9 +10,11 @@
|
|||||||
|
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/error.hpp>
|
#include <beast/core/error.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
@@ -59,31 +61,35 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_some_op* op)
|
std::size_t size, read_some_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, read_some_op* op)
|
void* p, std::size_t size, read_some_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
bool asio_handler_is_continuation(read_some_op* op)
|
bool asio_handler_is_continuation(read_some_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_is_continuation;
|
||||||
is_continuation(op->d_.handler());
|
return asio_handler_is_continuation(
|
||||||
|
std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_some_op* op)
|
void asio_handler_invoke(Function&& f, read_some_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -8,8 +8,9 @@
|
|||||||
#ifndef BEAST_IMPL_HANDLER_PTR_HPP
|
#ifndef BEAST_IMPL_HANDLER_PTR_HPP
|
||||||
#define BEAST_IMPL_HANDLER_PTR_HPP
|
#define BEAST_IMPL_HANDLER_PTR_HPP
|
||||||
|
|
||||||
#include <beast/core/handler_helpers.hpp>
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
#include <boost/asio/detail/handler_alloc_helpers.hpp>
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -23,9 +24,10 @@ P(DeducedHandler&& h, Args&&... args)
|
|||||||
: n(1)
|
: n(1)
|
||||||
, handler(std::forward<DeducedHandler>(h))
|
, handler(std::forward<DeducedHandler>(h))
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_allocate;
|
||||||
t = reinterpret_cast<T*>(
|
t = reinterpret_cast<T*>(
|
||||||
beast_asio_helpers::
|
asio_handler_allocate(
|
||||||
allocate(sizeof(T), handler));
|
sizeof(T), std::addressof(handler)));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
t = new(t) T{handler,
|
t = new(t) T{handler,
|
||||||
@@ -33,8 +35,9 @@ P(DeducedHandler&& h, Args&&... args)
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(t, sizeof(T), handler);
|
asio_handler_deallocate(
|
||||||
|
t, sizeof(T), std::addressof(handler));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,8 +53,9 @@ handler_ptr<T, Handler>::
|
|||||||
if(p_->t)
|
if(p_->t)
|
||||||
{
|
{
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
asio_handler_deallocate(
|
||||||
|
p_->t, sizeof(T), std::addressof(p_->handler));
|
||||||
}
|
}
|
||||||
delete p_;
|
delete p_;
|
||||||
}
|
}
|
||||||
@@ -103,8 +107,9 @@ release_handler() ->
|
|||||||
BOOST_ASSERT(p_);
|
BOOST_ASSERT(p_);
|
||||||
BOOST_ASSERT(p_->t);
|
BOOST_ASSERT(p_->t);
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
asio_handler_deallocate(
|
||||||
|
p_->t, sizeof(T), std::addressof(p_->handler));
|
||||||
p_->t = nullptr;
|
p_->t = nullptr;
|
||||||
return std::move(p_->handler);
|
return std::move(p_->handler);
|
||||||
}
|
}
|
||||||
@@ -118,8 +123,9 @@ invoke(Args&&... args)
|
|||||||
BOOST_ASSERT(p_);
|
BOOST_ASSERT(p_);
|
||||||
BOOST_ASSERT(p_->t);
|
BOOST_ASSERT(p_->t);
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
asio_handler_deallocate(
|
||||||
|
p_->t, sizeof(T), std::addressof(p_->handler));
|
||||||
p_->t = nullptr;
|
p_->t = nullptr;
|
||||||
p_->handler(std::forward<Args>(args)...);
|
p_->handler(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,11 @@
|
|||||||
#include <beast/http/message_parser.hpp>
|
#include <beast/http/message_parser.hpp>
|
||||||
#include <beast/http/read.hpp>
|
#include <beast/http/read.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
@@ -43,12 +45,12 @@ class read_some_buffer_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
||||||
basic_parser<isRequest, isDirect, Derived>& p_)
|
basic_parser<isRequest, isDirect, Derived>& p_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, db(db_)
|
, db(db_)
|
||||||
, p(p_)
|
, p(p_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,8 +78,9 @@ public:
|
|||||||
asio_handler_allocate(std::size_t size,
|
asio_handler_allocate(std::size_t size,
|
||||||
read_some_buffer_op* op)
|
read_some_buffer_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -86,8 +89,9 @@ public:
|
|||||||
void* p, std::size_t size,
|
void* p, std::size_t size,
|
||||||
read_some_buffer_op* op)
|
read_some_buffer_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -104,8 +108,9 @@ public:
|
|||||||
asio_handler_invoke(Function&& f,
|
asio_handler_invoke(Function&& f,
|
||||||
read_some_buffer_op* op)
|
read_some_buffer_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -233,12 +238,12 @@ class read_some_body_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
||||||
basic_parser<isRequest, true, Derived>& p_)
|
basic_parser<isRequest, true, Derived>& p_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, db(db_)
|
, db(db_)
|
||||||
, p(p_)
|
, p(p_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -266,8 +271,9 @@ public:
|
|||||||
asio_handler_allocate(std::size_t size,
|
asio_handler_allocate(std::size_t size,
|
||||||
read_some_body_op* op)
|
read_some_body_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -276,8 +282,9 @@ public:
|
|||||||
void* p, std::size_t size,
|
void* p, std::size_t size,
|
||||||
read_some_body_op* op)
|
read_some_body_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -294,8 +301,9 @@ public:
|
|||||||
asio_handler_invoke(Function&& f,
|
asio_handler_invoke(Function&& f,
|
||||||
read_some_body_op* op)
|
read_some_body_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -374,12 +382,12 @@ class parse_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
data(Handler& handler, Stream& s_, DynamicBuffer& db_,
|
||||||
basic_parser<isRequest, isDirect, Derived>& p_)
|
basic_parser<isRequest, isDirect, Derived>& p_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, db(db_)
|
, db(db_)
|
||||||
, p(p_)
|
, p(p_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -407,8 +415,9 @@ public:
|
|||||||
asio_handler_allocate(
|
asio_handler_allocate(
|
||||||
std::size_t size, parse_op* op)
|
std::size_t size, parse_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -417,8 +426,9 @@ public:
|
|||||||
void* p, std::size_t size,
|
void* p, std::size_t size,
|
||||||
parse_op* op)
|
parse_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -435,8 +445,9 @@ public:
|
|||||||
asio_handler_invoke(
|
asio_handler_invoke(
|
||||||
Function&& f, parse_op* op)
|
Function&& f, parse_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -486,12 +497,12 @@ class read_message_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
DynamicBuffer& sb_, message_type& m_)
|
DynamicBuffer& sb_, message_type& m_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
, m(m_)
|
, m(m_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -516,16 +527,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_message_op* op)
|
std::size_t size, read_message_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, read_message_op* op)
|
void* p, std::size_t size, read_message_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -538,8 +551,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_message_op* op)
|
void asio_handler_invoke(Function&& f, read_message_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -13,9 +13,11 @@
|
|||||||
#include <beast/http/message_parser.hpp>
|
#include <beast/http/message_parser.hpp>
|
||||||
#include <beast/http/read.hpp>
|
#include <beast/http/read.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
|
@@ -13,11 +13,13 @@
|
|||||||
#include <beast/core/buffer_cat.hpp>
|
#include <beast/core/buffer_cat.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/ostream.hpp>
|
#include <beast/core/ostream.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/multi_buffer.hpp>
|
#include <beast/core/multi_buffer.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
#include <beast/core/detail/sync_ostream.hpp>
|
#include <beast/core/detail/sync_ostream.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/asio/write.hpp>
|
#include <boost/asio/write.hpp>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -93,11 +95,11 @@ class write_streambuf_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
multi_buffer&& sb_)
|
multi_buffer&& sb_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, b(std::move(sb_))
|
, b(std::move(sb_))
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -124,16 +126,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_streambuf_op* op)
|
std::size_t size, write_streambuf_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, write_streambuf_op* op)
|
void* p, std::size_t size, write_streambuf_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -146,8 +150,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_streambuf_op* op)
|
void asio_handler_invoke(Function&& f, write_streambuf_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -291,11 +296,11 @@ class write_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
message<isRequest, Body, Fields> const& m_)
|
message<isRequest, Body, Fields> const& m_)
|
||||||
: cont(beast_asio_helpers::
|
: s(s_)
|
||||||
is_continuation(handler))
|
|
||||||
, s(s_)
|
|
||||||
, wp(m_)
|
, wp(m_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -375,16 +380,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, write_op* op)
|
void* p, std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -397,8 +404,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,9 +15,11 @@
|
|||||||
#include <beast/http/string_body.hpp>
|
#include <beast/http/string_body.hpp>
|
||||||
#include <beast/http/write.hpp>
|
#include <beast/http/write.hpp>
|
||||||
#include <beast/core/buffer_prefix.hpp>
|
#include <beast/core/buffer_prefix.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/detail/type_traits.hpp>
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -92,16 +94,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, response_op* op)
|
std::size_t size, response_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, response_op* op)
|
void* p, std::size_t size, response_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -114,8 +118,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, response_op* op)
|
void asio_handler_invoke(Function&& f, response_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,20 +178,22 @@ class stream<NextLayer>::accept_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
Decorator const& decorator_)
|
Decorator const& decorator_)
|
||||||
: cont(beast_asio_helpers::is_continuation(handler))
|
: ws(ws_)
|
||||||
, ws(ws_)
|
|
||||||
, decorator(decorator_)
|
, decorator(decorator_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Buffers>
|
template<class Buffers>
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
Buffers const& buffers,
|
Buffers const& buffers,
|
||||||
Decorator const& decorator_)
|
Decorator const& decorator_)
|
||||||
: cont(beast_asio_helpers::is_continuation(handler))
|
: ws(ws_)
|
||||||
, ws(ws_)
|
|
||||||
, decorator(decorator_)
|
, decorator(decorator_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
using boost::asio::buffer_copy;
|
using boost::asio::buffer_copy;
|
||||||
using boost::asio::buffer_size;
|
using boost::asio::buffer_size;
|
||||||
// VFALCO What about catch(std::length_error const&)?
|
// VFALCO What about catch(std::length_error const&)?
|
||||||
@@ -218,16 +225,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, accept_op* op)
|
std::size_t size, accept_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, accept_op* op)
|
void* p, std::size_t size, accept_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -240,8 +249,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, accept_op* op)
|
void asio_handler_invoke(Function&& f, accept_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -690,11 +700,12 @@ async_accept(http::header<true, Fields> const& req,
|
|||||||
async_completion<AcceptHandler,
|
async_completion<AcceptHandler,
|
||||||
void(error_code)> init{handler};
|
void(error_code)> init{handler};
|
||||||
reset();
|
reset();
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
response_op<handler_type<
|
response_op<handler_type<
|
||||||
AcceptHandler, void(error_code)>>{init.completion_handler,
|
AcceptHandler, void(error_code)>>{init.completion_handler,
|
||||||
*this, req, &default_decorate_res,
|
*this, req, &default_decorate_res,
|
||||||
beast_asio_helpers::is_continuation(
|
asio_handler_is_continuation(
|
||||||
init.completion_handler)};
|
std::addressof(init.completion_handler))};
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,11 +726,12 @@ async_accept_ex(http::header<true, Fields> const& req,
|
|||||||
async_completion<AcceptHandler,
|
async_completion<AcceptHandler,
|
||||||
void(error_code)> init{handler};
|
void(error_code)> init{handler};
|
||||||
reset();
|
reset();
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
response_op<handler_type<
|
response_op<handler_type<
|
||||||
AcceptHandler, void(error_code)>>{
|
AcceptHandler, void(error_code)>>{
|
||||||
init.completion_handler, *this, req, decorator,
|
init.completion_handler, *this, req, decorator,
|
||||||
beast_asio_helpers::is_continuation(
|
asio_handler_is_continuation(
|
||||||
init.completion_handler)};
|
std::addressof(init.completion_handler))};
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,11 +753,12 @@ async_accept(http::header<true, Fields> const& req,
|
|||||||
async_completion<AcceptHandler,
|
async_completion<AcceptHandler,
|
||||||
void(error_code)> init{handler};
|
void(error_code)> init{handler};
|
||||||
reset();
|
reset();
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
response_op<handler_type<
|
response_op<handler_type<
|
||||||
AcceptHandler, void(error_code)>>{
|
AcceptHandler, void(error_code)>>{
|
||||||
init.completion_handler, *this, req, buffers,
|
init.completion_handler, *this, req, buffers,
|
||||||
&default_decorate_res, beast_asio_helpers::
|
&default_decorate_res, asio_handler_is_continuation(
|
||||||
is_continuation(init.completion_handler)};
|
std::addressof(init.completion_handler))};
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,11 +784,11 @@ async_accept_ex(http::header<true, Fields> const& req,
|
|||||||
async_completion<AcceptHandler,
|
async_completion<AcceptHandler,
|
||||||
void(error_code)> init{handler};
|
void(error_code)> init{handler};
|
||||||
reset();
|
reset();
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
response_op<handler_type<
|
response_op<handler_type<
|
||||||
AcceptHandler, void(error_code)>>{init.completion_handler,
|
AcceptHandler, void(error_code)>>{init.completion_handler,
|
||||||
*this, req, buffers, decorator,
|
*this, req, buffers, decorator, asio_handler_is_continuation(
|
||||||
beast_asio_helpers::is_continuation(
|
std::addressof(init.completion_handler))};
|
||||||
init.completion_handler)};
|
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,10 +8,12 @@
|
|||||||
#ifndef BEAST_WEBSOCKET_IMPL_CLOSE_IPP
|
#ifndef BEAST_WEBSOCKET_IMPL_CLOSE_IPP
|
||||||
#define BEAST_WEBSOCKET_IMPL_CLOSE_IPP
|
#define BEAST_WEBSOCKET_IMPL_CLOSE_IPP
|
||||||
|
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/static_buffer.hpp>
|
#include <beast/core/static_buffer.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -37,11 +39,11 @@ class stream<NextLayer>::close_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
close_reason const& cr_)
|
close_reason const& cr_)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, cr(cr_)
|
, cr(cr_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
ws.template write_close<
|
ws.template write_close<
|
||||||
static_buffer>(fb, cr);
|
static_buffer>(fb, cr);
|
||||||
}
|
}
|
||||||
@@ -77,16 +79,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, close_op* op)
|
std::size_t size, close_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, close_op* op)
|
void* p, std::size_t size, close_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -99,8 +103,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, close_op* op)
|
void asio_handler_invoke(Function&& f, close_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -12,9 +12,11 @@
|
|||||||
#include <beast/http/message.hpp>
|
#include <beast/http/message.hpp>
|
||||||
#include <beast/http/read.hpp>
|
#include <beast/http/read.hpp>
|
||||||
#include <beast/http/write.hpp>
|
#include <beast/http/write.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -45,13 +47,13 @@ class stream<NextLayer>::handshake_op
|
|||||||
string_view const& host,
|
string_view const& host,
|
||||||
string_view const& target,
|
string_view const& target,
|
||||||
Decorator const& decorator)
|
Decorator const& decorator)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, res_p(res_p_)
|
, res_p(res_p_)
|
||||||
, req(ws.build_request(key,
|
, req(ws.build_request(key,
|
||||||
host, target, decorator))
|
host, target, decorator))
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
ws.reset();
|
ws.reset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -78,16 +80,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, handshake_op* op)
|
std::size_t size, handshake_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, handshake_op* op)
|
void* p, std::size_t size, handshake_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -100,8 +104,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, handshake_op* op)
|
void asio_handler_invoke(Function&& f, handshake_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -9,10 +9,12 @@
|
|||||||
#define BEAST_WEBSOCKET_IMPL_PING_IPP
|
#define BEAST_WEBSOCKET_IMPL_PING_IPP
|
||||||
|
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
#include <beast/websocket/detail/frame.hpp>
|
#include <beast/websocket/detail/frame.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -35,10 +37,10 @@ class stream<NextLayer>::ping_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
opcode op_, ping_data const& payload)
|
opcode op_, ping_data const& payload)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
using boost::asio::buffer;
|
using boost::asio::buffer;
|
||||||
using boost::asio::buffer_copy;
|
using boost::asio::buffer_copy;
|
||||||
ws.template write_ping<
|
ws.template write_ping<
|
||||||
@@ -74,16 +76,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, ping_op* op)
|
std::size_t size, ping_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, ping_op* op)
|
void* p, std::size_t size, ping_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -96,8 +100,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, ping_op* op)
|
void asio_handler_invoke(Function&& f, ping_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -10,11 +10,13 @@
|
|||||||
|
|
||||||
#include <beast/websocket/teardown.hpp>
|
#include <beast/websocket/teardown.hpp>
|
||||||
#include <beast/core/buffer_prefix.hpp>
|
#include <beast/core/buffer_prefix.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/static_buffer.hpp>
|
#include <beast/core/static_buffer.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
#include <beast/core/detail/clamp.hpp>
|
#include <beast/core/detail/clamp.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -57,12 +59,12 @@ class stream<NextLayer>::read_frame_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
frame_info& fi_, DynamicBuffer& sb_)
|
frame_info& fi_, DynamicBuffer& sb_)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, fi(fi_)
|
, fi(fi_)
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,16 +103,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_frame_op* op)
|
std::size_t size, read_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, read_frame_op* op)
|
void* p, std::size_t size, read_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -123,8 +127,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_frame_op* op)
|
void asio_handler_invoke(Function&& f, read_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1005,12 +1010,12 @@ class stream<NextLayer>::read_op
|
|||||||
data(Handler& handler,
|
data(Handler& handler,
|
||||||
stream<NextLayer>& ws_, opcode& op_,
|
stream<NextLayer>& ws_, opcode& op_,
|
||||||
DynamicBuffer& sb_)
|
DynamicBuffer& sb_)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, op(op_)
|
, op(op_)
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1036,16 +1041,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_op* op)
|
std::size_t size, read_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, read_op* op)
|
void* p, std::size_t size, read_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -1058,8 +1065,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_op* op)
|
void asio_handler_invoke(Function&& f, read_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -9,9 +9,11 @@
|
|||||||
#define BEAST_WEBSOCKET_IMPL_SSL_IPP_INCLUDED
|
#define BEAST_WEBSOCKET_IMPL_SSL_IPP_INCLUDED
|
||||||
|
|
||||||
#include <beast/core/async_result.hpp>
|
#include <beast/core/async_result.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace websocket {
|
namespace websocket {
|
||||||
@@ -45,10 +47,10 @@ class teardown_ssl_op
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
data(Handler& handler, stream_type& stream_)
|
data(Handler& handler, stream_type& stream_)
|
||||||
: cont(beast_asio_helpers::
|
: stream(stream_)
|
||||||
is_continuation(handler))
|
|
||||||
, stream(stream_)
|
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,16 +73,18 @@ public:
|
|||||||
void* asio_handler_allocate(std::size_t size,
|
void* asio_handler_allocate(std::size_t size,
|
||||||
teardown_ssl_op* op)
|
teardown_ssl_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(void* p,
|
void asio_handler_deallocate(void* p,
|
||||||
std::size_t size, teardown_ssl_op* op)
|
std::size_t size, teardown_ssl_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -95,8 +99,9 @@ public:
|
|||||||
void asio_handler_invoke(Function&& f,
|
void asio_handler_invoke(Function&& f,
|
||||||
teardown_ssl_op* op)
|
teardown_ssl_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -9,9 +9,11 @@
|
|||||||
#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP
|
#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP
|
||||||
|
|
||||||
#include <beast/core/async_result.hpp>
|
#include <beast/core/async_result.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -33,10 +35,10 @@ class teardown_tcp_op
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
data(Handler& handler, socket_type& socket_)
|
data(Handler& handler, socket_type& socket_)
|
||||||
: cont(beast_asio_helpers::
|
: socket(socket_)
|
||||||
is_continuation(handler))
|
|
||||||
, socket(socket_)
|
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,16 +61,18 @@ public:
|
|||||||
void* asio_handler_allocate(std::size_t size,
|
void* asio_handler_allocate(std::size_t size,
|
||||||
teardown_tcp_op* op)
|
teardown_tcp_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(void* p,
|
void asio_handler_deallocate(void* p,
|
||||||
std::size_t size, teardown_tcp_op* op)
|
std::size_t size, teardown_tcp_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -82,8 +86,9 @@ public:
|
|||||||
void asio_handler_invoke(Function&& f,
|
void asio_handler_invoke(Function&& f,
|
||||||
teardown_tcp_op* op)
|
teardown_tcp_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -12,12 +12,14 @@
|
|||||||
#include <beast/core/buffer_cat.hpp>
|
#include <beast/core/buffer_cat.hpp>
|
||||||
#include <beast/core/buffer_prefix.hpp>
|
#include <beast/core/buffer_prefix.hpp>
|
||||||
#include <beast/core/consuming_buffers.hpp>
|
#include <beast/core/consuming_buffers.hpp>
|
||||||
#include <beast/core/handler_helpers.hpp>
|
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/static_buffer.hpp>
|
#include <beast/core/static_buffer.hpp>
|
||||||
#include <beast/core/type_traits.hpp>
|
#include <beast/core/type_traits.hpp>
|
||||||
#include <beast/core/detail/clamp.hpp>
|
#include <beast/core/detail/clamp.hpp>
|
||||||
#include <beast/websocket/detail/frame.hpp>
|
#include <beast/websocket/detail/frame.hpp>
|
||||||
|
#include <boost/asio/handler_alloc_hook.hpp>
|
||||||
|
#include <boost/asio/handler_continuation_hook.hpp>
|
||||||
|
#include <boost/asio/handler_invoke_hook.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -31,7 +33,6 @@ class stream<NextLayer>::write_frame_op
|
|||||||
{
|
{
|
||||||
struct data : op
|
struct data : op
|
||||||
{
|
{
|
||||||
Handler& handler;
|
|
||||||
bool cont;
|
bool cont;
|
||||||
stream<NextLayer>& ws;
|
stream<NextLayer>& ws;
|
||||||
consuming_buffers<Buffers> cb;
|
consuming_buffers<Buffers> cb;
|
||||||
@@ -43,15 +44,14 @@ class stream<NextLayer>::write_frame_op
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
int entry_state;
|
int entry_state;
|
||||||
|
|
||||||
data(Handler& handler_, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
bool fin_, Buffers const& bs)
|
bool fin_, Buffers const& bs)
|
||||||
: handler(handler_)
|
: ws(ws_)
|
||||||
, cont(beast_asio_helpers::
|
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, cb(bs)
|
, cb(bs)
|
||||||
, fin(fin_)
|
, fin(fin_)
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,16 +90,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_frame_op* op)
|
std::size_t size, write_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, write_frame_op* op)
|
void* p, std::size_t size, write_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -112,8 +114,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -801,12 +804,12 @@ class stream<NextLayer>::write_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
Buffers const& bs)
|
Buffers const& bs)
|
||||||
: cont(beast_asio_helpers::
|
: ws(ws_)
|
||||||
is_continuation(handler))
|
|
||||||
, ws(ws_)
|
|
||||||
, cb(bs)
|
, cb(bs)
|
||||||
, remain(boost::asio::buffer_size(cb))
|
, remain(boost::asio::buffer_size(cb))
|
||||||
{
|
{
|
||||||
|
using boost::asio::asio_handler_is_continuation;
|
||||||
|
cont = asio_handler_is_continuation(std::addressof(handler));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -832,16 +835,18 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_allocate;
|
||||||
allocate(size, op->d_.handler());
|
return asio_handler_allocate(
|
||||||
|
size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, write_op* op)
|
void* p, std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_deallocate;
|
||||||
deallocate(p, size, op->d_.handler());
|
asio_handler_deallocate(
|
||||||
|
p, size, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
@@ -854,8 +859,9 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return beast_asio_helpers::
|
using boost::asio::asio_handler_invoke;
|
||||||
invoke(f, op->d_.handler());
|
asio_handler_invoke(
|
||||||
|
f, std::addressof(op->d_.handler()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user