forked from boostorg/beast
Add handler helpers
This commit is contained in:
1 parent
114175cd1f
commit
851cb62a50
19 files changed
+208
-115
No files matched your search
@@ -13,7 +13,7 @@
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/string_body.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/prepare_buffers.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, response_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, response_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
@@ -154,7 +154,7 @@ class stream<NextLayer>::accept_op
|
||||
template<class Buffers>
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
Buffers const& buffers)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, accept_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, accept_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
@@ -308,7 +308,7 @@ async_accept(http::request<Body, Fields> const& req,
|
||||
reset();
|
||||
response_op<decltype(completion.handler)>{
|
||||
completion.handler, *this, req,
|
||||
boost_asio_handler_cont_helpers::
|
||||
beast_asio_helpers::
|
||||
is_continuation(completion.handler)};
|
||||
return completion.result.get();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef 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/static_streambuf.hpp>
|
||||
#include <beast/core/stream_concepts.hpp>
|
||||
@@ -25,8 +25,6 @@ template<class NextLayer>
|
||||
template<class Handler>
|
||||
class stream<NextLayer>::close_op
|
||||
{
|
||||
using alloc_type = handler_alloc<char, Handler>;
|
||||
|
||||
using fb_type = detail::frame_streambuf;
|
||||
|
||||
struct data : op
|
||||
@@ -39,7 +37,7 @@ class stream<NextLayer>::close_op
|
||||
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
close_reason const& cr_)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, cr(cr_)
|
||||
@@ -80,7 +78,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, close_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -88,7 +86,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -102,7 +100,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, close_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/read.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/stream_concepts.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
@@ -29,9 +29,6 @@ template<class NextLayer>
|
||||
template<class Handler>
|
||||
class stream<NextLayer>::handshake_op
|
||||
{
|
||||
using alloc_type =
|
||||
handler_alloc<char, Handler>;
|
||||
|
||||
struct data
|
||||
{
|
||||
bool cont;
|
||||
@@ -44,7 +41,7 @@ class stream<NextLayer>::handshake_op
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
boost::string_ref const& host,
|
||||
boost::string_ref const& resource)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, req(ws.build_request(host, resource, key))
|
||||
@@ -76,7 +73,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, handshake_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -84,7 +81,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -98,7 +95,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, handshake_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define BEAST_WEBSOCKET_IMPL_PING_IPP
|
||||
|
||||
#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/stream_concepts.hpp>
|
||||
#include <beast/websocket/detail/frame.hpp>
|
||||
@@ -35,7 +35,7 @@ class stream<NextLayer>::ping_op
|
||||
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
opcode op_, ping_data const& payload)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, ping_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, ping_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <beast/websocket/teardown.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/prepare_buffers.hpp>
|
||||
#include <beast/core/static_streambuf.hpp>
|
||||
@@ -54,7 +54,7 @@ class stream<NextLayer>::read_frame_op
|
||||
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
frame_info& fi_, DynamicBuffer& sb_)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, fi(fi_)
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, read_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
friend
|
||||
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());
|
||||
}
|
||||
};
|
||||
@@ -741,7 +741,7 @@ class stream<NextLayer>::read_op
|
||||
data(Handler& handler,
|
||||
stream<NextLayer>& ws_, opcode& op_,
|
||||
DynamicBuffer& sb_)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, op(op_)
|
||||
@@ -773,7 +773,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, read_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, read_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define BEAST_WEBSOCKET_IMPL_SSL_IPP_INCLUDED
|
||||
|
||||
#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_ptr.hpp>
|
||||
|
||||
@@ -45,7 +45,7 @@ class teardown_ssl_op
|
||||
int state = 0;
|
||||
|
||||
data(Handler& handler, stream_type& stream_)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, stream(stream_)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
void* asio_handler_allocate(std::size_t size,
|
||||
teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
void asio_handler_deallocate(void* p,
|
||||
std::size_t size, teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
deallocate(p, size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP
|
||||
|
||||
#include <beast/core/async_completion.hpp>
|
||||
#include <beast/core/handler_alloc.hpp>
|
||||
#include <beast/core/handler_concepts.hpp>
|
||||
#include <beast/core/handler_helpers.hpp>
|
||||
#include <beast/core/handler_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
@@ -22,9 +22,6 @@ namespace detail {
|
||||
template<class Handler>
|
||||
class teardown_tcp_op
|
||||
{
|
||||
using alloc_type =
|
||||
handler_alloc<char, Handler>;
|
||||
|
||||
using socket_type =
|
||||
boost::asio::ip::tcp::socket;
|
||||
|
||||
@@ -36,7 +33,7 @@ class teardown_tcp_op
|
||||
int state = 0;
|
||||
|
||||
data(Handler& handler, socket_type& socket_)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, socket(socket_)
|
||||
{
|
||||
@@ -64,7 +61,7 @@ public:
|
||||
void* asio_handler_allocate(std::size_t size,
|
||||
teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -72,7 +69,7 @@ public:
|
||||
void asio_handler_deallocate(void* p,
|
||||
std::size_t size, teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
deallocate(p, size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -87,7 +84,7 @@ public:
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <beast/core/buffer_cat.hpp>
|
||||
#include <beast/core/buffer_concepts.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/prepare_buffers.hpp>
|
||||
#include <beast/core/static_streambuf.hpp>
|
||||
@@ -115,7 +115,7 @@ class stream<NextLayer>::write_frame_op
|
||||
data(Handler& handler_, stream<NextLayer>& ws_,
|
||||
bool fin, Buffers const& bs)
|
||||
: handler(handler_)
|
||||
, cont(boost_asio_handler_cont_helpers::
|
||||
, cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, cb(bs)
|
||||
@@ -135,7 +135,7 @@ class stream<NextLayer>::write_frame_op
|
||||
fh.key = ws.maskgen_();
|
||||
detail::prepare_key(key, fh.key);
|
||||
tmp_size = clamp(fh.len, ws.wr_buf_size_);
|
||||
tmp = boost_asio_handler_alloc_helpers::
|
||||
tmp = beast_asio_helpers::
|
||||
allocate(tmp_size, handler);
|
||||
remain = fh.len;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class stream<NextLayer>::write_frame_op
|
||||
~data()
|
||||
{
|
||||
if(tmp)
|
||||
boost_asio_handler_alloc_helpers::
|
||||
beast_asio_helpers::
|
||||
deallocate(tmp, tmp_size, handler);
|
||||
}
|
||||
};
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, write_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
friend
|
||||
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());
|
||||
}
|
||||
};
|
||||
@@ -533,7 +533,7 @@ class stream<NextLayer>::write_op
|
||||
|
||||
data(Handler& handler, stream<NextLayer>& ws_,
|
||||
Buffers const& bs)
|
||||
: cont(boost_asio_handler_cont_helpers::
|
||||
: cont(beast_asio_helpers::
|
||||
is_continuation(handler))
|
||||
, ws(ws_)
|
||||
, cb(bs)
|
||||
@@ -565,7 +565,7 @@ public:
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, write_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
return beast_asio_helpers::
|
||||
allocate(size, op->d_.handler());
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ public:
|
||||
void asio_handler_deallocate(
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ public:
|
||||
friend
|
||||
void asio_handler_invoke(Function&& f, write_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
return beast_asio_helpers::
|
||||
invoke(f, op->d_.handler());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user