forked from boostorg/beast
Add handler helpers
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
* Fix broken Intellisense
|
* Fix broken Intellisense
|
||||||
* Implement the Asio deallocation-before-invocation guarantee
|
* Implement the Asio deallocation-before-invocation guarantee
|
||||||
|
* Add handler helpers
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
#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/placeholders.hpp>
|
#include <beast/core/placeholders.hpp>
|
||||||
#include <beast/core/streambuf.hpp>
|
#include <beast/core/streambuf.hpp>
|
||||||
@@ -89,9 +90,6 @@ private:
|
|||||||
bool isRequest, class Body, class Fields>
|
bool isRequest, class Body, class Fields>
|
||||||
class write_op
|
class write_op
|
||||||
{
|
{
|
||||||
using alloc_type =
|
|
||||||
handler_alloc<char, Handler>;
|
|
||||||
|
|
||||||
struct data
|
struct data
|
||||||
{
|
{
|
||||||
bool cont;
|
bool cont;
|
||||||
@@ -100,7 +98,7 @@ private:
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
message<isRequest, Body, Fields>&& m_)
|
message<isRequest, Body, Fields>&& m_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, m(std::move(m_))
|
, m(std::move(m_))
|
||||||
@@ -140,7 +138,7 @@ private:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +146,7 @@ private:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +160,7 @@ private:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
#include <beast/core/error.hpp>
|
#include <beast/core/error.hpp>
|
||||||
#include <beast/core/handler_alloc.hpp>
|
#include <beast/core/handler_alloc.hpp>
|
||||||
#include <beast/core/handler_concepts.hpp>
|
#include <beast/core/handler_concepts.hpp>
|
||||||
|
#include <beast/core/handler_helpers.hpp>
|
||||||
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/placeholders.hpp>
|
#include <beast/core/placeholders.hpp>
|
||||||
#include <beast/core/prepare_buffers.hpp>
|
#include <beast/core/prepare_buffers.hpp>
|
||||||
#include <beast/core/static_streambuf.hpp>
|
#include <beast/core/static_streambuf.hpp>
|
||||||
|
@@ -8,10 +8,8 @@
|
|||||||
#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/detail/handler_alloc_helpers.hpp>
|
|
||||||
#include <boost/asio/detail/handler_cont_helpers.hpp>
|
|
||||||
#include <boost/asio/detail/handler_invoke_helpers.hpp>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -69,7 +67,7 @@ public:
|
|||||||
asio_handler_allocate(
|
asio_handler_allocate(
|
||||||
std::size_t size, bound_handler* h)
|
std::size_t size, bound_handler* h)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, h->h_);
|
allocate(size, h->h_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +76,7 @@ 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)
|
||||||
{
|
{
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(p, size, h->h_);
|
deallocate(p, size, h->h_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +84,7 @@ public:
|
|||||||
bool
|
bool
|
||||||
asio_handler_is_continuation(bound_handler* h)
|
asio_handler_is_continuation(bound_handler* h)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_cont_helpers::
|
return beast_asio_helpers::
|
||||||
is_continuation (h->h_);
|
is_continuation (h->h_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +93,7 @@ public:
|
|||||||
void
|
void
|
||||||
asio_handler_invoke(F&& f, bound_handler* h)
|
asio_handler_invoke(F&& f, bound_handler* h)
|
||||||
{
|
{
|
||||||
boost_asio_handler_invoke_helpers::
|
beast_asio_helpers::
|
||||||
invoke(f, h->h_);
|
invoke(f, h->h_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#ifndef BEAST_HANDLER_ALLOC_HPP
|
#ifndef BEAST_HANDLER_ALLOC_HPP
|
||||||
#define BEAST_HANDLER_ALLOC_HPP
|
#define BEAST_HANDLER_ALLOC_HPP
|
||||||
|
|
||||||
#include <boost/asio/detail/handler_alloc_helpers.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
{
|
{
|
||||||
auto const size = n * sizeof(T);
|
auto const size = n * sizeof(T);
|
||||||
return static_cast<value_type*>(
|
return static_cast<value_type*>(
|
||||||
boost_asio_handler_alloc_helpers::allocate(
|
beast_asio_helpers::allocate(
|
||||||
size, h_));
|
size, h_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
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);
|
||||||
boost_asio_handler_alloc_helpers::deallocate(
|
beast_asio_helpers::deallocate(
|
||||||
p, size, h_);
|
p, size, h_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
104
include/beast/core/handler_helpers.hpp
Normal file
104
include/beast/core/handler_helpers.hpp
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2013-2016 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 <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
|
@@ -11,7 +11,7 @@
|
|||||||
#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_concepts.hpp>
|
#include <beast/core/handler_concepts.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>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
@@ -21,9 +21,6 @@ template<class MutableBufferSequence, class Handler>
|
|||||||
class dynabuf_readstream<
|
class dynabuf_readstream<
|
||||||
Stream, DynamicBuffer>::read_some_op
|
Stream, DynamicBuffer>::read_some_op
|
||||||
{
|
{
|
||||||
using alloc_type =
|
|
||||||
handler_alloc<char, Handler>;
|
|
||||||
|
|
||||||
// VFALCO What about bool cont for is_continuation?
|
// VFALCO What about bool cont for is_continuation?
|
||||||
struct data
|
struct data
|
||||||
{
|
{
|
||||||
@@ -63,7 +60,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,14 +68,14 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
friend
|
friend
|
||||||
bool asio_handler_is_continuation(read_some_op* op)
|
bool asio_handler_is_continuation(read_some_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_cont_helpers::
|
return beast_asio_helpers::
|
||||||
is_continuation(op->d_.handler());
|
is_continuation(op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +83,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_some_op* op)
|
void asio_handler_invoke(Function&& f, read_some_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#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/detail/handler_alloc_helpers.hpp>
|
#include <boost/asio/detail/handler_alloc_helpers.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -23,7 +24,7 @@ P(DeducedHandler&& h, Args&&... args)
|
|||||||
, handler(std::forward<DeducedHandler>(h))
|
, handler(std::forward<DeducedHandler>(h))
|
||||||
{
|
{
|
||||||
t = reinterpret_cast<T*>(
|
t = reinterpret_cast<T*>(
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
allocate(sizeof(T), handler));
|
allocate(sizeof(T), handler));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,7 @@ P(DeducedHandler&& h, Args&&... args)
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(t, sizeof(T), handler);
|
deallocate(t, sizeof(T), handler);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -58,7 +59,7 @@ handler_ptr<T, Handler>::
|
|||||||
if(p_->t)
|
if(p_->t)
|
||||||
{
|
{
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
deallocate(p_->t, sizeof(T), p_->handler);
|
||||||
}
|
}
|
||||||
delete p_;
|
delete p_;
|
||||||
@@ -90,7 +91,7 @@ release_handler() ->
|
|||||||
BOOST_ASSERT(p_);
|
BOOST_ASSERT(p_);
|
||||||
BOOST_ASSERT(p_->t);
|
BOOST_ASSERT(p_->t);
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
deallocate(p_->t, sizeof(T), p_->handler);
|
||||||
p_->t = nullptr;
|
p_->t = nullptr;
|
||||||
return std::move(p_->handler);
|
return std::move(p_->handler);
|
||||||
@@ -105,7 +106,7 @@ invoke(Args&&... args)
|
|||||||
BOOST_ASSERT(p_);
|
BOOST_ASSERT(p_);
|
||||||
BOOST_ASSERT(p_->t);
|
BOOST_ASSERT(p_->t);
|
||||||
p_->t->~T();
|
p_->t->~T();
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(p_->t, sizeof(T), p_->handler);
|
deallocate(p_->t, sizeof(T), p_->handler);
|
||||||
p_->t = nullptr;
|
p_->t = nullptr;
|
||||||
p_->handler(std::forward<Args>(args)...);
|
p_->handler(std::forward<Args>(args)...);
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <beast/http/concepts.hpp>
|
#include <beast/http/concepts.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.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/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@@ -35,7 +35,7 @@ class parse_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
DynamicBuffer& sb_, Parser& p_)
|
DynamicBuffer& sb_, Parser& p_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, parse_op* op)
|
std::size_t size, parse_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, parse_op* op)
|
void* p, std::size_t size, parse_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, parse_op* op)
|
void asio_handler_invoke(Function&& f, parse_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include <beast/http/parse.hpp>
|
#include <beast/http/parse.hpp>
|
||||||
#include <beast/http/parser_v1.hpp>
|
#include <beast/http/parser_v1.hpp>
|
||||||
#include <beast/core/bind_handler.hpp>
|
#include <beast/core/bind_handler.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/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@@ -46,7 +46,7 @@ class read_header_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
DynamicBuffer& sb_, message_type& m_)
|
DynamicBuffer& sb_, message_type& m_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_header_op* op)
|
std::size_t size, read_header_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
void asio_handler_deallocate(
|
void asio_handler_deallocate(
|
||||||
void* p, std::size_t size, read_header_op* op)
|
void* p, std::size_t size, read_header_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_header_op* op)
|
void asio_handler_invoke(Function&& f, read_header_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -219,7 +219,7 @@ class read_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
DynamicBuffer& sb_, message_type& m_)
|
DynamicBuffer& sb_, message_type& m_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, db(sb_)
|
, db(sb_)
|
||||||
@@ -250,7 +250,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_op* op)
|
std::size_t size, read_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_op* op)
|
void asio_handler_invoke(Function&& f, read_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#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/buffer_concepts.hpp>
|
#include <beast/core/buffer_concepts.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/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
#include <beast/core/streambuf.hpp>
|
#include <beast/core/streambuf.hpp>
|
||||||
@@ -109,7 +109,7 @@ class write_streambuf_op
|
|||||||
|
|
||||||
data(Handler& handler, Stream& s_,
|
data(Handler& handler, Stream& s_,
|
||||||
streambuf&& sb_)
|
streambuf&& sb_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, sb(std::move(sb_))
|
, sb(std::move(sb_))
|
||||||
@@ -141,7 +141,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_streambuf_op* op)
|
void asio_handler_invoke(Function&& f, write_streambuf_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -303,7 +303,7 @@ 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(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, s(s_)
|
, s(s_)
|
||||||
, wp(m_)
|
, wp(m_)
|
||||||
@@ -406,7 +406,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +428,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#include <beast/http/read.hpp>
|
#include <beast/http/read.hpp>
|
||||||
#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/handler_alloc.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/prepare_buffers.hpp>
|
#include <beast/core/prepare_buffers.hpp>
|
||||||
#include <beast/core/detail/type_traits.hpp>
|
#include <beast/core/detail/type_traits.hpp>
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, response_op* op)
|
std::size_t size, response_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, response_op* op)
|
void asio_handler_invoke(Function&& f, response_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -154,7 +154,7 @@ class stream<NextLayer>::accept_op
|
|||||||
template<class Buffers>
|
template<class Buffers>
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
Buffers const& buffers)
|
Buffers const& buffers)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
{
|
{
|
||||||
@@ -195,7 +195,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, accept_op* op)
|
std::size_t size, accept_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, accept_op* op)
|
void asio_handler_invoke(Function&& f, accept_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -308,7 +308,7 @@ async_accept(http::request<Body, Fields> const& req,
|
|||||||
reset();
|
reset();
|
||||||
response_op<decltype(completion.handler)>{
|
response_op<decltype(completion.handler)>{
|
||||||
completion.handler, *this, req,
|
completion.handler, *this, req,
|
||||||
boost_asio_handler_cont_helpers::
|
beast_asio_helpers::
|
||||||
is_continuation(completion.handler)};
|
is_continuation(completion.handler)};
|
||||||
return completion.result.get();
|
return completion.result.get();
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#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_alloc.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/static_streambuf.hpp>
|
#include <beast/core/static_streambuf.hpp>
|
||||||
#include <beast/core/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
@@ -25,8 +25,6 @@ template<class NextLayer>
|
|||||||
template<class Handler>
|
template<class Handler>
|
||||||
class stream<NextLayer>::close_op
|
class stream<NextLayer>::close_op
|
||||||
{
|
{
|
||||||
using alloc_type = handler_alloc<char, Handler>;
|
|
||||||
|
|
||||||
using fb_type = detail::frame_streambuf;
|
using fb_type = detail::frame_streambuf;
|
||||||
|
|
||||||
struct data : op
|
struct data : op
|
||||||
@@ -39,7 +37,7 @@ 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(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, cr(cr_)
|
, cr(cr_)
|
||||||
@@ -80,7 +78,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, close_op* op)
|
std::size_t size, close_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +86,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +100,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, close_op* op)
|
void asio_handler_invoke(Function&& f, close_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#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_alloc.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@@ -29,9 +29,6 @@ template<class NextLayer>
|
|||||||
template<class Handler>
|
template<class Handler>
|
||||||
class stream<NextLayer>::handshake_op
|
class stream<NextLayer>::handshake_op
|
||||||
{
|
{
|
||||||
using alloc_type =
|
|
||||||
handler_alloc<char, Handler>;
|
|
||||||
|
|
||||||
struct data
|
struct data
|
||||||
{
|
{
|
||||||
bool cont;
|
bool cont;
|
||||||
@@ -44,7 +41,7 @@ class stream<NextLayer>::handshake_op
|
|||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
boost::string_ref const& host,
|
boost::string_ref const& host,
|
||||||
boost::string_ref const& resource)
|
boost::string_ref const& resource)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, req(ws.build_request(host, resource, key))
|
, req(ws.build_request(host, resource, key))
|
||||||
@@ -76,7 +73,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, handshake_op* op)
|
std::size_t size, handshake_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +81,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +95,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, handshake_op* op)
|
void asio_handler_invoke(Function&& f, handshake_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#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_alloc.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <beast/core/stream_concepts.hpp>
|
#include <beast/core/stream_concepts.hpp>
|
||||||
#include <beast/websocket/detail/frame.hpp>
|
#include <beast/websocket/detail/frame.hpp>
|
||||||
@@ -35,7 +35,7 @@ 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(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, ping_op* op)
|
std::size_t size, ping_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, ping_op* op)
|
void asio_handler_invoke(Function&& f, ping_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <beast/websocket/teardown.hpp>
|
#include <beast/websocket/teardown.hpp>
|
||||||
#include <beast/core/buffer_concepts.hpp>
|
#include <beast/core/buffer_concepts.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/prepare_buffers.hpp>
|
#include <beast/core/prepare_buffers.hpp>
|
||||||
#include <beast/core/static_streambuf.hpp>
|
#include <beast/core/static_streambuf.hpp>
|
||||||
@@ -54,7 +54,7 @@ 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(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, fi(fi_)
|
, fi(fi_)
|
||||||
@@ -99,7 +99,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_frame_op* op)
|
void asio_handler_invoke(Function&& f, read_frame_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -741,7 +741,7 @@ 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(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, op(op_)
|
, op(op_)
|
||||||
@@ -773,7 +773,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, read_op* op)
|
std::size_t size, read_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,7 +795,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, read_op* op)
|
void asio_handler_invoke(Function&& f, read_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#define BEAST_WEBSOCKET_IMPL_SSL_IPP_INCLUDED
|
#define BEAST_WEBSOCKET_IMPL_SSL_IPP_INCLUDED
|
||||||
|
|
||||||
#include <beast/core/async_completion.hpp>
|
#include <beast/core/async_completion.hpp>
|
||||||
#include <beast/core/handler_alloc.hpp>
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_concepts.hpp>
|
#include <beast/core/handler_concepts.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ class teardown_ssl_op
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
data(Handler& handler, stream_type& stream_)
|
data(Handler& handler, stream_type& stream_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, stream(stream_)
|
, stream(stream_)
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
void asio_handler_invoke(Function&& f,
|
void asio_handler_invoke(Function&& f,
|
||||||
teardown_ssl_op* op)
|
teardown_ssl_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP
|
#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP
|
||||||
|
|
||||||
#include <beast/core/async_completion.hpp>
|
#include <beast/core/async_completion.hpp>
|
||||||
#include <beast/core/handler_alloc.hpp>
|
|
||||||
#include <beast/core/handler_concepts.hpp>
|
#include <beast/core/handler_concepts.hpp>
|
||||||
|
#include <beast/core/handler_helpers.hpp>
|
||||||
#include <beast/core/handler_ptr.hpp>
|
#include <beast/core/handler_ptr.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -22,9 +22,6 @@ namespace detail {
|
|||||||
template<class Handler>
|
template<class Handler>
|
||||||
class teardown_tcp_op
|
class teardown_tcp_op
|
||||||
{
|
{
|
||||||
using alloc_type =
|
|
||||||
handler_alloc<char, Handler>;
|
|
||||||
|
|
||||||
using socket_type =
|
using socket_type =
|
||||||
boost::asio::ip::tcp::socket;
|
boost::asio::ip::tcp::socket;
|
||||||
|
|
||||||
@@ -36,7 +33,7 @@ class teardown_tcp_op
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
data(Handler& handler, socket_type& socket_)
|
data(Handler& handler, socket_type& socket_)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, socket(socket_)
|
, socket(socket_)
|
||||||
{
|
{
|
||||||
@@ -64,7 +61,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +69,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +84,7 @@ public:
|
|||||||
void asio_handler_invoke(Function&& f,
|
void asio_handler_invoke(Function&& f,
|
||||||
teardown_tcp_op* op)
|
teardown_tcp_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
#include <beast/core/buffer_cat.hpp>
|
#include <beast/core/buffer_cat.hpp>
|
||||||
#include <beast/core/buffer_concepts.hpp>
|
#include <beast/core/buffer_concepts.hpp>
|
||||||
#include <beast/core/consuming_buffers.hpp>
|
#include <beast/core/consuming_buffers.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/prepare_buffers.hpp>
|
#include <beast/core/prepare_buffers.hpp>
|
||||||
#include <beast/core/static_streambuf.hpp>
|
#include <beast/core/static_streambuf.hpp>
|
||||||
@@ -115,7 +115,7 @@ class stream<NextLayer>::write_frame_op
|
|||||||
data(Handler& handler_, stream<NextLayer>& ws_,
|
data(Handler& handler_, stream<NextLayer>& ws_,
|
||||||
bool fin, Buffers const& bs)
|
bool fin, Buffers const& bs)
|
||||||
: handler(handler_)
|
: handler(handler_)
|
||||||
, cont(boost_asio_handler_cont_helpers::
|
, cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, cb(bs)
|
, cb(bs)
|
||||||
@@ -135,7 +135,7 @@ class stream<NextLayer>::write_frame_op
|
|||||||
fh.key = ws.maskgen_();
|
fh.key = ws.maskgen_();
|
||||||
detail::prepare_key(key, fh.key);
|
detail::prepare_key(key, fh.key);
|
||||||
tmp_size = clamp(fh.len, ws.wr_buf_size_);
|
tmp_size = clamp(fh.len, ws.wr_buf_size_);
|
||||||
tmp = boost_asio_handler_alloc_helpers::
|
tmp = beast_asio_helpers::
|
||||||
allocate(tmp_size, handler);
|
allocate(tmp_size, handler);
|
||||||
remain = fh.len;
|
remain = fh.len;
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ class stream<NextLayer>::write_frame_op
|
|||||||
~data()
|
~data()
|
||||||
{
|
{
|
||||||
if(tmp)
|
if(tmp)
|
||||||
boost_asio_handler_alloc_helpers::
|
beast_asio_helpers::
|
||||||
deallocate(tmp, tmp_size, handler);
|
deallocate(tmp, tmp_size, handler);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -183,7 +183,7 @@ 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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -533,7 +533,7 @@ class stream<NextLayer>::write_op
|
|||||||
|
|
||||||
data(Handler& handler, stream<NextLayer>& ws_,
|
data(Handler& handler, stream<NextLayer>& ws_,
|
||||||
Buffers const& bs)
|
Buffers const& bs)
|
||||||
: cont(boost_asio_handler_cont_helpers::
|
: cont(beast_asio_helpers::
|
||||||
is_continuation(handler))
|
is_continuation(handler))
|
||||||
, ws(ws_)
|
, ws(ws_)
|
||||||
, cb(bs)
|
, cb(bs)
|
||||||
@@ -565,7 +565,7 @@ public:
|
|||||||
void* asio_handler_allocate(
|
void* asio_handler_allocate(
|
||||||
std::size_t size, write_op* op)
|
std::size_t size, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
allocate(size, op->d_.handler());
|
allocate(size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ public:
|
|||||||
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 boost_asio_handler_alloc_helpers::
|
return beast_asio_helpers::
|
||||||
deallocate(p, size, op->d_.handler());
|
deallocate(p, size, op->d_.handler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ public:
|
|||||||
friend
|
friend
|
||||||
void asio_handler_invoke(Function&& f, write_op* op)
|
void asio_handler_invoke(Function&& f, write_op* op)
|
||||||
{
|
{
|
||||||
return boost_asio_handler_invoke_helpers::
|
return beast_asio_helpers::
|
||||||
invoke(f, op->d_.handler());
|
invoke(f, op->d_.handler());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user