Remove handler helpers, tidy up hook invocations (API Change)

This commit is contained in:
Vinnie Falco committed 2017-07-20 08:12:17 -07:00
1 parent 68a0f3af4f
commit 71e4fbe428
21 files changed
+315 -380

No files matched your search

+28 -22
View File
@@ -12,12 +12,14 @@
#include <beast/core/buffer_cat.hpp>
#include <beast/core/buffer_prefix.hpp>
#include <beast/core/consuming_buffers.hpp>
#include <beast/core/handler_helpers.hpp>
#include <beast/core/handler_ptr.hpp>
#include <beast/core/static_buffer.hpp>
#include <beast/core/type_traits.hpp>
#include <beast/core/detail/clamp.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 <algorithm>
#include <memory>
@@ -31,7 +33,6 @@ class stream<NextLayer>::write_frame_op
{
struct data : op
{
Handler& handler;
bool cont;
stream<NextLayer>& ws;
consuming_buffers<Buffers> cb;
@@ -43,15 +44,14 @@ class stream<NextLayer>::write_frame_op
int state = 0;
int entry_state;
data(Handler& handler_, stream<NextLayer>& ws_,
data(Handler& handler, stream<NextLayer>& ws_,
bool fin_, Buffers const& bs)
: handler(handler_)
, cont(beast_asio_helpers::
is_continuation(handler))
, ws(ws_)
: ws(ws_)
, cb(bs)
, 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(
std::size_t size, write_frame_op* op)
{
return beast_asio_helpers::
allocate(size, op->d_.handler());
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(op->d_.handler()));
}
friend
void asio_handler_deallocate(
void* p, std::size_t size, write_frame_op* op)
{
return beast_asio_helpers::
deallocate(p, size, op->d_.handler());
using boost::asio::asio_handler_deallocate;
asio_handler_deallocate(
p, size, std::addressof(op->d_.handler()));
}
friend
@@ -112,8 +114,9 @@ public:
friend
void asio_handler_invoke(Function&& f, write_frame_op* op)
{
return beast_asio_helpers::
invoke(f, op->d_.handler());
using boost::asio::asio_handler_invoke;
asio_handler_invoke(
f, std::addressof(op->d_.handler()));
}
};
@@ -801,12 +804,12 @@ class stream<NextLayer>::write_op
data(Handler& handler, stream<NextLayer>& ws_,
Buffers const& bs)
: cont(beast_asio_helpers::
is_continuation(handler))
, ws(ws_)
: ws(ws_)
, cb(bs)
, 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(
std::size_t size, write_op* op)
{
return beast_asio_helpers::
allocate(size, op->d_.handler());
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(op->d_.handler()));
}
friend
void asio_handler_deallocate(
void* p, std::size_t size, write_op* op)
{
return beast_asio_helpers::
deallocate(p, size, op->d_.handler());
using boost::asio::asio_handler_deallocate;
asio_handler_deallocate(
p, size, std::addressof(op->d_.handler()));
}
friend
@@ -854,8 +859,9 @@ public:
friend
void asio_handler_invoke(Function&& f, write_op* op)
{
return beast_asio_helpers::
invoke(f, op->d_.handler());
using boost::asio::asio_handler_invoke;
asio_handler_invoke(
f, std::addressof(op->d_.handler()));
}
};