mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Remove obsolete handler wrappers
This commit is contained in:
@@ -156,15 +156,22 @@ public:
|
|||||||
HandlerCall will meet this requirement:
|
HandlerCall will meet this requirement:
|
||||||
CompletionHandler
|
CompletionHandler
|
||||||
*/
|
*/
|
||||||
|
/** @{ */
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
HandlerCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Completion,
|
HandlerCall (Post, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
Context context = Context ())
|
: m_call (construct <PostCallType> (Context (),
|
||||||
: m_call (construct <PostCallType> (
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
context))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Handler>
|
||||||
|
HandlerCall (Post, Context context, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
|
: m_call (construct <PostCallType> (context,
|
||||||
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Construct a HandlerCall with one bound parameter.
|
/** Construct a HandlerCall with one bound parameter.
|
||||||
|
|
||||||
Produce a CompletionHandler that includes one bound parameter.
|
Produce a CompletionHandler that includes one bound parameter.
|
||||||
@@ -189,15 +196,22 @@ public:
|
|||||||
HandlerCall will meet this requirement:
|
HandlerCall will meet this requirement:
|
||||||
CompletionHandler
|
CompletionHandler
|
||||||
*/
|
*/
|
||||||
|
/** @{ */
|
||||||
template <typename Handler, typename Arg1>
|
template <typename Handler, typename Arg1>
|
||||||
HandlerCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Completion,
|
HandlerCall (Post, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1)
|
||||||
Context context = Context ())
|
: m_call (construct <PostCallType1> (Context (),
|
||||||
: m_call (construct <PostCallType1> (
|
BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1))
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
context, arg1))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Handler, typename Arg1>
|
||||||
|
HandlerCall (Post, Context context, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1)
|
||||||
|
: m_call (construct <PostCallType1> (context,
|
||||||
|
BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Construct a HandlerCall with two bound parameters.
|
/** Construct a HandlerCall with two bound parameters.
|
||||||
|
|
||||||
Produce a CompletionHandler that includes two bound parameters.
|
Produce a CompletionHandler that includes two bound parameters.
|
||||||
@@ -221,15 +235,22 @@ public:
|
|||||||
The HandlerCall will meet these requirements:
|
The HandlerCall will meet these requirements:
|
||||||
CompletionHandler
|
CompletionHandler
|
||||||
*/
|
*/
|
||||||
|
/** @{ */
|
||||||
template <typename Handler, typename Arg1, typename Arg2>
|
template <typename Handler, typename Arg1, typename Arg2>
|
||||||
HandlerCall (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
HandlerCall (Post, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Arg2 arg2)
|
||||||
Arg1 arg1, Arg2 arg2, Completion, Context context = Context ())
|
: m_call (construct <PostCallType2> (Context (),
|
||||||
: m_call (construct <PostCallType2> (
|
BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2))
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
context, arg1, arg2))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Handler, typename Arg1, typename Arg2>
|
||||||
|
HandlerCall (Post, Context context, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Arg2 arg2)
|
||||||
|
: m_call (construct <PostCallType2> (context,
|
||||||
|
BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Construct a HandlerCall from a handler that takes an error_code
|
/** Construct a HandlerCall from a handler that takes an error_code
|
||||||
|
|
||||||
Handler must meet one of these requirements:
|
Handler must meet one of these requirements:
|
||||||
@@ -244,15 +265,22 @@ public:
|
|||||||
ShutdownHandler
|
ShutdownHandler
|
||||||
HandshakeHandler
|
HandshakeHandler
|
||||||
*/
|
*/
|
||||||
|
/** @{ */
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
HandlerCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Error,
|
HandlerCall (Error, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
Context context = Context ())
|
: m_call (construct <ErrorCallType> (Context (),
|
||||||
: m_call (construct <ErrorCallType> (
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
context))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Handler>
|
||||||
|
HandlerCall (Error, Context context, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
|
: m_call (construct <ErrorCallType> (context,
|
||||||
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Construct a HandlerCall from a handler that takes an error_code and std::size
|
/** Construct a HandlerCall from a handler that takes an error_code and std::size
|
||||||
|
|
||||||
Handler must meet one of these requirements:
|
Handler must meet one of these requirements:
|
||||||
@@ -265,15 +293,22 @@ public:
|
|||||||
WriteHandler
|
WriteHandler
|
||||||
BufferedHandshakeHandler
|
BufferedHandshakeHandler
|
||||||
*/
|
*/
|
||||||
|
/** @{ */
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
HandlerCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Transfer,
|
HandlerCall (Transfer, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
Context context = Context ())
|
: m_call (construct <TransferCallType> (Context (),
|
||||||
: m_call (construct <TransferCallType> (
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
context))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Handler>
|
||||||
|
HandlerCall (Transfer, Context context, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
|
: m_call (construct <TransferCallType> (context,
|
||||||
|
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Copy construction and assignment.
|
/** Copy construction and assignment.
|
||||||
|
|
||||||
HandlerCall is a very lightweight object that holds a shared
|
HandlerCall is a very lightweight object that holds a shared
|
||||||
@@ -532,46 +567,41 @@ private:
|
|||||||
// ownership of the handler from the stack.
|
// ownership of the handler from the stack.
|
||||||
|
|
||||||
template <template <typename> class Container, typename Handler>
|
template <template <typename> class Container, typename Handler>
|
||||||
static Call* construct (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
static Call* construct (Context context, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
Context context)
|
|
||||||
{
|
{
|
||||||
typedef Container <Handler> ContainerType;
|
typedef Container <Handler> ContainerType;
|
||||||
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
||||||
std::size_t const size (sizeof (ContainerType));
|
std::size_t const size (sizeof (ContainerType));
|
||||||
void* const p = boost_asio_handler_alloc_helpers::
|
void* const p = boost_asio_handler_alloc_helpers::
|
||||||
allocate <Handler> (size, local);
|
allocate <Handler> (size, local);
|
||||||
return ::new (p) ContainerType (
|
return ::new (p) ContainerType (context, size,
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(local), size, context);
|
BOOST_ASIO_MOVE_CAST(Handler)(local));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename, typename> class Container,
|
template <template <typename, typename> class Container,
|
||||||
typename Handler, typename Arg1>
|
typename Handler, typename Arg1>
|
||||||
static Call* construct (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
static Call* construct (Context context, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1)
|
||||||
Context context, Arg1 arg1)
|
|
||||||
{
|
{
|
||||||
typedef Container <Handler, Arg1> ContainerType;
|
typedef Container <Handler, Arg1> ContainerType;
|
||||||
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
||||||
std::size_t const size (sizeof (ContainerType));
|
std::size_t const size (sizeof (ContainerType));
|
||||||
void* const p = boost_asio_handler_alloc_helpers::
|
void* const p = boost_asio_handler_alloc_helpers::
|
||||||
allocate <Handler> (size, local);
|
allocate <Handler> (size, local);
|
||||||
return ::new (p) ContainerType (
|
return ::new (p) ContainerType (context, size,
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(local),
|
BOOST_ASIO_MOVE_CAST(Handler)(local), arg1);
|
||||||
size, context, arg1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename, typename, typename> class Container,
|
template <template <typename, typename, typename> class Container,
|
||||||
typename Handler, typename Arg1, typename Arg2>
|
typename Handler, typename Arg1, typename Arg2>
|
||||||
static Call* construct (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
static Call* construct (Context context, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Arg2 arg2)
|
||||||
Context context, Arg1 arg1, Arg2 arg2)
|
|
||||||
{
|
{
|
||||||
typedef Container <Handler, Arg1, Arg2> ContainerType;
|
typedef Container <Handler, Arg1, Arg2> ContainerType;
|
||||||
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
Handler local (BOOST_ASIO_MOVE_CAST(Handler)(handler));
|
||||||
std::size_t const size (sizeof (ContainerType));
|
std::size_t const size (sizeof (ContainerType));
|
||||||
void* const p = boost_asio_handler_alloc_helpers::
|
void* const p = boost_asio_handler_alloc_helpers::
|
||||||
allocate <Handler> (size, local);
|
allocate <Handler> (size, local);
|
||||||
return ::new (p) ContainerType (
|
return ::new (p) ContainerType (context, size,
|
||||||
BOOST_ASIO_MOVE_CAST(Handler)(local),
|
BOOST_ASIO_MOVE_CAST(Handler)(local), arg1, arg2);
|
||||||
size, context, arg1, arg2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -734,8 +764,7 @@ private:
|
|||||||
// Context must have Call as a base or this will result in
|
// Context must have Call as a base or this will result in
|
||||||
// undefined behavior.
|
// undefined behavior.
|
||||||
//
|
//
|
||||||
CallType (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
CallType (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
std::size_t size, Context context)
|
|
||||||
: Call (context)
|
: Call (context)
|
||||||
, m_size (size)
|
, m_size (size)
|
||||||
, m_handler (BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
, m_handler (BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
@@ -833,10 +862,8 @@ private:
|
|||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
struct PostCallType : CallType <Handler>
|
struct PostCallType : CallType <Handler>
|
||||||
{
|
{
|
||||||
PostCallType (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
PostCallType (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
std::size_t size, Context context)
|
: CallType <Handler> (context, size, BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
: CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
size, context)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,10 +876,8 @@ private:
|
|||||||
template <typename Handler, typename Arg1>
|
template <typename Handler, typename Arg1>
|
||||||
struct PostCallType1 : CallType <Handler>
|
struct PostCallType1 : CallType <Handler>
|
||||||
{
|
{
|
||||||
PostCallType1 (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
PostCallType1 (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1)
|
||||||
std::size_t size, Context context, Arg1 arg1)
|
: CallType <Handler> (context, size, BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
: CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
size, context)
|
|
||||||
, m_arg1 (arg1)
|
, m_arg1 (arg1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -868,10 +893,8 @@ private:
|
|||||||
template <typename Handler, typename Arg1, typename Arg2>
|
template <typename Handler, typename Arg1, typename Arg2>
|
||||||
struct PostCallType2 : CallType <Handler>
|
struct PostCallType2 : CallType <Handler>
|
||||||
{
|
{
|
||||||
PostCallType2 (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
PostCallType2 (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Arg2 arg2)
|
||||||
std::size_t size, Context context, Arg1 arg1, Arg2 arg2)
|
: CallType <Handler> (context, size, BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
: CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
size, context)
|
|
||||||
, m_arg1 (arg1)
|
, m_arg1 (arg1)
|
||||||
, m_arg2 (arg2)
|
, m_arg2 (arg2)
|
||||||
{
|
{
|
||||||
@@ -889,10 +912,8 @@ private:
|
|||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
struct ErrorCallType : CallType <Handler>
|
struct ErrorCallType : CallType <Handler>
|
||||||
{
|
{
|
||||||
ErrorCallType (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
ErrorCallType (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
std::size_t size, Context context)
|
: CallType <Handler> (context, size, BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
: CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
size, context)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -905,10 +926,8 @@ private:
|
|||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
struct TransferCallType : CallType <Handler>
|
struct TransferCallType : CallType <Handler>
|
||||||
{
|
{
|
||||||
TransferCallType (BOOST_ASIO_MOVE_ARG(Handler) handler,
|
TransferCallType (Context context, std::size_t size, BOOST_ASIO_MOVE_ARG(Handler) handler)
|
||||||
std::size_t size, Context context)
|
: CallType <Handler> (context, size, BOOST_ASIO_MOVE_CAST(Handler)(handler))
|
||||||
: CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler),
|
|
||||||
size, context)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,65 +955,6 @@ private:
|
|||||||
SharedObjectPtr <Call> m_call;
|
SharedObjectPtr <Call> m_call;
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class CompletionCall : public HandlerCall
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CompletionCall ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Handler>
|
|
||||||
explicit CompletionCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
|
|
||||||
: HandlerCall (BOOST_ASIO_MOVE_CAST(Handler)(handler), HandlerCall::Post ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Handler, typename Arg1>
|
|
||||||
explicit CompletionCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1)
|
|
||||||
: HandlerCall (BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, HandlerCall::Post ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
template <typename Handler, typename Arg1, typename Arg2>
|
|
||||||
explicit CompletionCall (BOOST_ASIO_MOVE_ARG(Handler) handler, Arg1 arg1, Arg2 arg2)
|
|
||||||
: HandlerCall (BOOST_ASIO_MOVE_CAST(Handler)(handler), arg1, arg2, HandlerCall::Post ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class ErrorCall : public HandlerCall
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ErrorCall ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Handler>
|
|
||||||
explicit ErrorCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
|
|
||||||
: HandlerCall (BOOST_ASIO_MOVE_CAST(Handler)(handler), HandlerCall::Error ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class TransferCall : public HandlerCall
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TransferCall ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Handler>
|
|
||||||
explicit TransferCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
|
|
||||||
: HandlerCall (BOOST_ASIO_MOVE_CAST(Handler)(handler), HandlerCall::Transfer ())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Specializations
|
// Specializations
|
||||||
|
|||||||
@@ -60,13 +60,7 @@ public:
|
|||||||
|
|
||||||
virtual void on_async_detect (Logic& logic,
|
virtual void on_async_detect (Logic& logic,
|
||||||
error_code const& ec, ConstBuffers const& buffers,
|
error_code const& ec, ConstBuffers const& buffers,
|
||||||
ErrorCall const& origHandler) = 0;
|
HandlerCall const& origHandler) = 0;
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
|
||||||
virtual void on_async_detect (Logic& logic,
|
|
||||||
error_code const& ec, ConstBuffers const& buffers,
|
|
||||||
TransferCall const& origHandler) = 0;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -149,49 +143,18 @@ public:
|
|||||||
HandshakeHandler, void (error_code)> init(
|
HandshakeHandler, void (error_code)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
|
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
m_origHandler = ErrorCall (
|
m_origHandler = HandlerCall (
|
||||||
BOOST_ASIO_MOVE_CAST(HandshakeHandler)
|
BOOST_ASIO_MOVE_CAST(HandshakeHandler)
|
||||||
(HandshakeHandler(init.handler)));
|
(HandshakeHandler(init.handler)));
|
||||||
async_do_handshake (type, ConstBuffers ());
|
async_do_handshake (type, ConstBuffers ());
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
m_origHandler = ErrorCall (
|
m_origHandler = HandlerCall (
|
||||||
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
|
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
|
||||||
async_do_handshake (type, ConstBuffers ());
|
async_do_handshake (type, ConstBuffers ());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
|
||||||
template <typename ConstBufferSequence>
|
|
||||||
error_code handshake (handshake_type type,
|
|
||||||
const ConstBufferSequence& buffers, error_code& ec)
|
|
||||||
{
|
|
||||||
return do_handshake (type, ec, ConstBuffers (buffers));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (error_code, std::size_t))
|
|
||||||
async_handshake(handshake_type type, const ConstBufferSequence& buffers,
|
|
||||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
|
|
||||||
{
|
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
|
||||||
boost::asio::detail::async_result_init<
|
|
||||||
BufferedHandshakeHandler, void (error_code, std::size_t)> init(
|
|
||||||
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler));
|
|
||||||
// init.handler is copied
|
|
||||||
m_origBufferedHandler = TransferCall (
|
|
||||||
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)
|
|
||||||
(BufferedHandshakeHandler(init.handler)));
|
|
||||||
async_do_handshake (type, ConstBuffers (buffers));
|
|
||||||
return init.result.get();
|
|
||||||
#else
|
|
||||||
m_origBufferedHandler = TransferCall (
|
|
||||||
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler(handler)));
|
|
||||||
async_do_handshake (type, ConstBuffers (buffers));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
error_code do_handshake (handshake_type, error_code& ec, ConstBuffers const& buffers)
|
error_code do_handshake (handshake_type, error_code& ec, ConstBuffers const& buffers)
|
||||||
@@ -244,16 +207,8 @@ public:
|
|||||||
// Get the execution context from the original handler
|
// Get the execution context from the original handler
|
||||||
// and signal the beginning of our composed operation.
|
// and signal the beginning of our composed operation.
|
||||||
//
|
//
|
||||||
if (m_origHandler.isNotNull ())
|
m_origHandler.beginComposed ();
|
||||||
{
|
m_context = m_origHandler.getContext ();
|
||||||
m_origHandler.beginComposed ();
|
|
||||||
m_context = m_origHandler.getContext ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_origBufferedHandler.beginComposed ();
|
|
||||||
m_context = m_origBufferedHandler.getContext ();
|
|
||||||
}
|
|
||||||
|
|
||||||
bassert (m_context.isNotNull ());
|
bassert (m_context.isNotNull ());
|
||||||
|
|
||||||
@@ -288,22 +243,6 @@ public:
|
|||||||
bassert (consumed <= m_buffer.size ());
|
bassert (consumed <= m_buffer.size ());
|
||||||
m_buffer.consume (consumed);
|
m_buffer.consume (consumed);
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
|
||||||
if (! m_origBufferedHandler.isNull ())
|
|
||||||
{
|
|
||||||
bassert (m_origHandler.isNull ());
|
|
||||||
|
|
||||||
// The composed operation has completed and
|
|
||||||
// the original handler will eventually get called.
|
|
||||||
//
|
|
||||||
m_origBufferedHandler.endComposed ();
|
|
||||||
m_callback->on_async_detect (m_logic.get (), ec,
|
|
||||||
ConstBuffers (m_buffer.data ()), m_origBufferedHandler);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The composed operation has completed and
|
// The composed operation has completed and
|
||||||
// the original handler will eventually get called.
|
// the original handler will eventually get called.
|
||||||
//
|
//
|
||||||
@@ -323,11 +262,10 @@ public:
|
|||||||
// of the original handler. This ensures that we meet the
|
// of the original handler. This ensures that we meet the
|
||||||
// execution safety requirements of the handler.
|
// execution safety requirements of the handler.
|
||||||
//
|
//
|
||||||
HandlerCall handler (boost::bind (
|
HandlerCall handler (HandlerCall::Read (), m_context,
|
||||||
&this_type::on_async_read_some, this,
|
boost::bind (&this_type::on_async_read_some, this,
|
||||||
boost::asio::placeholders::error,
|
boost::asio::placeholders::error,
|
||||||
boost::asio::placeholders::bytes_transferred),
|
boost::asio::placeholders::bytes_transferred));
|
||||||
HandlerCall::Read (), m_context);
|
|
||||||
m_next_layer.async_read_some (buffers, handler);
|
m_next_layer.async_read_some (buffers, handler);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -335,17 +273,7 @@ public:
|
|||||||
|
|
||||||
// Error condition
|
// Error condition
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
m_origHandler.endComposed ();
|
||||||
if (! m_origBufferedHandler.isNull ())
|
|
||||||
{
|
|
||||||
m_origBufferedHandler.endComposed ();
|
|
||||||
m_callback->on_async_detect (m_logic.get (), ec,
|
|
||||||
ConstBuffers (m_buffer.data ()), m_origBufferedHandler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_origBufferedHandler.endComposed ();
|
|
||||||
m_callback->on_async_detect (m_logic.get (), ec,
|
m_callback->on_async_detect (m_logic.get (), ec,
|
||||||
ConstBuffers (m_buffer.data ()), m_origHandler);
|
ConstBuffers (m_buffer.data ()), m_origHandler);
|
||||||
}
|
}
|
||||||
@@ -356,8 +284,8 @@ private:
|
|||||||
buffer_type m_buffer;
|
buffer_type m_buffer;
|
||||||
boost::asio::buffered_read_stream <stream_type&> m_stream;
|
boost::asio::buffered_read_stream <stream_type&> m_stream;
|
||||||
HandshakeDetectLogicType <Logic> m_logic;
|
HandshakeDetectLogicType <Logic> m_logic;
|
||||||
ErrorCall m_origHandler;
|
HandlerCall m_origHandler;
|
||||||
TransferCall m_origBufferedHandler;
|
HandlerCall m_origBufferedHandler;
|
||||||
HandlerCall::Context m_context;
|
HandlerCall::Context m_context;
|
||||||
};
|
};
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@@ -74,23 +74,23 @@ boost::system::error_code Socket::accept (Socket&, boost::system::error_code& ec
|
|||||||
return pure_virtual (ec);
|
return pure_virtual (ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code))
|
||||||
Socket::async_accept (Socket&, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
Socket::async_accept (Socket&, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
ErrorCall, void (boost::system::error_code)> init(
|
HandlerCall, void (boost::system::error_code)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,41 +111,41 @@ std::size_t Socket::write_some (ConstBuffers const&, boost::system::error_code&
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code, std::size_t))
|
||||||
Socket::async_read_some (MutableBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
Socket::async_read_some (MutableBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
TransferCall, void (boost::system::error_code, std::size_t)> init(
|
HandlerCall, void (boost::system::error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code, std::size_t))
|
||||||
Socket::async_write_some (ConstBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
Socket::async_write_some (ConstBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
TransferCall, void (boost::system::error_code, std::size_t)> init(
|
HandlerCall, void (boost::system::error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,23 +164,23 @@ boost::system::error_code Socket::handshake (handshake_type, boost::system::erro
|
|||||||
return pure_virtual (ec);
|
return pure_virtual (ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code))
|
||||||
Socket::async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
Socket::async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
ErrorCall, void (boost::system::error_code)> init(
|
HandlerCall, void (boost::system::error_code)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,24 +192,24 @@ boost::system::error_code Socket::handshake (handshake_type,
|
|||||||
return pure_virtual (ec);
|
return pure_virtual (ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code, std::size_t))
|
||||||
Socket::async_handshake (handshake_type, ConstBuffers const&,
|
Socket::async_handshake (handshake_type, ConstBuffers const&,
|
||||||
BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
TransferCall, void (boost::system::error_code, std::size_t)> init(
|
HandlerCall, void (boost::system::error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), ec, 0));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec, 0));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,23 +220,23 @@ boost::system::error_code Socket::shutdown (boost::system::error_code& ec)
|
|||||||
return pure_virtual (ec);
|
return pure_virtual (ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (boost::system::error_code))
|
||||||
Socket::async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
Socket::async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
ErrorCall, void (boost::system::error_code, std::size_t)> init(
|
HandlerCall, void (boost::system::error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
ec = pure_virtual (ec);
|
ec = pure_virtual (ec);
|
||||||
get_io_service ().post (boost::bind (
|
get_io_service ().post (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,13 +169,13 @@ public:
|
|||||||
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
|
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
|
||||||
{
|
{
|
||||||
return async_accept (peer,
|
return async_accept (peer,
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(ErrorCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (HandlerCall::Accept (),
|
||||||
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(ErrorCall) handler);
|
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -210,13 +210,13 @@ public:
|
|||||||
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
||||||
{
|
{
|
||||||
return async_read_some (MutableBuffers (buffers),
|
return async_read_some (MutableBuffers (buffers),
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (HandlerCall::Transfer (),
|
||||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler);
|
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
|
|
||||||
// AsyncWriteStream
|
// AsyncWriteStream
|
||||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncWriteStream.html
|
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncWriteStream.html
|
||||||
@@ -225,13 +225,13 @@ public:
|
|||||||
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
||||||
{
|
{
|
||||||
return async_write_some (ConstBuffers (buffers),
|
return async_write_some (ConstBuffers (buffers),
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (HandlerCall::Transfer (),
|
||||||
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler);
|
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -275,13 +275,13 @@ public:
|
|||||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
|
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
|
||||||
{
|
{
|
||||||
return async_handshake (type,
|
return async_handshake (type,
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(ErrorCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (HandlerCall::Error (),
|
||||||
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler);
|
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -318,14 +318,14 @@ public:
|
|||||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
|
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
|
||||||
{
|
{
|
||||||
return async_handshake (type, ConstBuffers (buffers),
|
return async_handshake (type, ConstBuffers (buffers),
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (
|
||||||
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
||||||
BOOST_ASIO_MOVE_ARG(TransferCall) handler);
|
BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -348,13 +348,13 @@ public:
|
|||||||
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
|
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
|
||||||
{
|
{
|
||||||
return async_shutdown (
|
return async_shutdown (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(ErrorCall (
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(HandlerCall (HandlerCall::Error (),
|
||||||
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler))));
|
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler))));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler);
|
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -363,19 +363,19 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
typedef typename native_socket <this_layer_type>::socket_type socket_type;
|
typedef typename native_socket <this_layer_type>::socket_type socket_type;
|
||||||
return async_accept (peer, BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
return async_accept (peer, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_accept <this_layer_type,
|
EnableIf <has_async_accept <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
(socket_type&, BOOST_ASIO_MOVE_ARG(TransferCall))>::value> ());
|
(socket_type&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename AcceptHandler>
|
template <typename AcceptHandler>
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE(HandlerCall, void (error_code))
|
||||||
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
|
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
|
||||||
boost::true_type)
|
boost::true_type)
|
||||||
{
|
{
|
||||||
@@ -395,12 +395,12 @@ public:
|
|||||||
AcceptHandler, void (error_code)> init(
|
AcceptHandler, void (error_code)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
|
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
AcceptHandler (init.handler), pure_virtual_error ()));
|
AcceptHandler (init.handler), pure_virtual_error ()));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler),
|
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler),
|
||||||
pure_virtual_error ()));
|
pure_virtual_error ()));
|
||||||
|
|
||||||
@@ -462,14 +462,14 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
return async_read_some (buffers, BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
|
return async_read_some (buffers, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_read_some <this_layer_type,
|
EnableIf <has_async_read_some <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
(MutableBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall))>::value> ());
|
(MutableBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MutableBufferSequence, typename ReadHandler>
|
template <typename MutableBufferSequence, typename ReadHandler>
|
||||||
@@ -491,12 +491,12 @@ public:
|
|||||||
ReadHandler, void (error_code, std::size_t)> init(
|
ReadHandler, void (error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
ReadHandler (init.handler), pure_virtual_error (), 0));
|
ReadHandler (init.handler), pure_virtual_error (), 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler),
|
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler),
|
||||||
pure_virtual_error (), 0));
|
pure_virtual_error (), 0));
|
||||||
|
|
||||||
@@ -505,40 +505,40 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
return async_write_some (buffers, BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
|
return async_write_some (buffers, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_write_some <this_layer_type,
|
EnableIf <has_async_write_some <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
(ConstBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall))>::value> ());
|
(ConstBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler,
|
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::true_type)
|
boost::true_type)
|
||||||
{
|
{
|
||||||
return m_object.async_write_some (buffers,
|
return m_object.async_write_some (buffers,
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_write_some (ConstBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall) handler,
|
async_write_some (ConstBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::false_type)
|
boost::false_type)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
TransferCall, void (error_code, std::size_t)> init(
|
HandlerCall, void (error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
TransferCall (init.handler), pure_virtual_error (), 0));
|
HandlerCall (init.handler), pure_virtual_error (), 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
pure_virtual_error (), 0));
|
pure_virtual_error (), 0));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -556,8 +556,8 @@ public:
|
|||||||
has_handshake <this_layer_type,
|
has_handshake <this_layer_type,
|
||||||
error_code (handshake_type, error_code&)>::value ||
|
error_code (handshake_type, error_code&)>::value ||
|
||||||
has_async_handshake <this_layer_type,
|
has_async_handshake <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
(handshake_type, BOOST_ASIO_MOVE_ARG(ErrorCall))>::value;
|
(handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -584,39 +584,39 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
return async_handshake (type, BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
return async_handshake (type, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_handshake <this_layer_type,
|
EnableIf <has_async_handshake <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
(handshake_type, BOOST_ASIO_MOVE_ARG(ErrorCall))>::value> ());
|
(handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler,
|
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::true_type)
|
boost::true_type)
|
||||||
{
|
{
|
||||||
return m_object.async_handshake (type,
|
return m_object.async_handshake (type,
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler,
|
async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::false_type)
|
boost::false_type)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
ErrorCall, void (error_code)> init(
|
HandlerCall, void (error_code)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
ErrorCall (init.handler), pure_virtual_error ()));
|
HandlerCall (init.handler), pure_virtual_error ()));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
pure_virtual_error ()));
|
pure_virtual_error ()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -647,41 +647,41 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
||||||
BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
return async_handshake (type, buffers, BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
|
return async_handshake (type, buffers, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_handshake <this_layer_type,
|
EnableIf <has_async_handshake <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
(handshake_type, ConstBuffers const&, error_code&)>::value> ());
|
(handshake_type, ConstBuffers const&, error_code&)>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_handshake (handshake_type type, ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler,
|
async_handshake (handshake_type type, ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::true_type)
|
boost::true_type)
|
||||||
{
|
{
|
||||||
return m_object.async_handshake (type, buffers,
|
return m_object.async_handshake (type, buffers,
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_handshake (handshake_type, ConstBuffers const&, BOOST_ASIO_MOVE_ARG(TransferCall) handler,
|
async_handshake (handshake_type, ConstBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::false_type)
|
boost::false_type)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
TransferCall, void (error_code, std::size_t)> init(
|
HandlerCall, void (error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
TransferCall (init.handler), pure_virtual_error (), 0));
|
HandlerCall (init.handler), pure_virtual_error (), 0));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
pure_virtual_error (), 0));
|
pure_virtual_error (), 0));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -713,39 +713,39 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
void async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
using namespace SocketWrapperMemberChecks;
|
using namespace SocketWrapperMemberChecks;
|
||||||
return async_shutdown (BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
return async_shutdown (BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
EnableIf <has_async_shutdown <this_layer_type,
|
EnableIf <has_async_shutdown <this_layer_type,
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
(BOOST_ASIO_MOVE_ARG(ErrorCall))>::value> ());
|
(BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler,
|
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::true_type)
|
boost::true_type)
|
||||||
{
|
{
|
||||||
return m_object.async_shutdown (
|
return m_object.async_shutdown (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler,
|
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler,
|
||||||
boost::false_type)
|
boost::false_type)
|
||||||
{
|
{
|
||||||
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
#if BEAST_ASIO_HAS_FUTURE_RETURNS
|
||||||
boost::asio::detail::async_result_init<
|
boost::asio::detail::async_result_init<
|
||||||
ErrorCall, void (error_code, std::size_t)> init(
|
HandlerCall, void (error_code, std::size_t)> init(
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
// init.handler is copied
|
// init.handler is copied
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
ErrorCall (init.handler), pure_virtual_error ()));
|
HandlerCall (init.handler), pure_virtual_error ()));
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
pure_virtual_error ()));
|
pure_virtual_error ()));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -159,14 +159,14 @@ public:
|
|||||||
ReadHandler, void (error_code, std::size_t)> init (
|
ReadHandler, void (error_code, std::size_t)> init (
|
||||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||||
|
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
ReadHandler(init.handler), // handler is copied
|
ReadHandler(init.handler), // handler is copied
|
||||||
error_code (), bytes_transferred));
|
error_code (), bytes_transferred));
|
||||||
|
|
||||||
return init.result.get();
|
return init.result.get();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return get_io_service ().post (CompletionCall (
|
return get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler),
|
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler),
|
||||||
error_code (), bytes_transferred));
|
error_code (), bytes_transferred));
|
||||||
|
|
||||||
|
|||||||
@@ -136,19 +136,19 @@ protected:
|
|||||||
return stream ().write_some (buffers, ec);
|
return stream ().write_some (buffers, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
return stream ().async_read_some (buffers, m_strand.wrap (boost::bind (
|
return stream ().async_read_some (buffers, m_strand.wrap (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), boost::asio::placeholders::error,
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), boost::asio::placeholders::error,
|
||||||
boost::asio::placeholders::bytes_transferred)));
|
boost::asio::placeholders::bytes_transferred)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
return stream ().async_write_some (buffers, m_strand.wrap (boost::bind (
|
return stream ().async_write_some (buffers, m_strand.wrap (boost::bind (
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler), boost::asio::placeholders::error,
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), boost::asio::placeholders::error,
|
||||||
boost::asio::placeholders::bytes_transferred)));
|
boost::asio::placeholders::bytes_transferred)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,34 +160,7 @@ protected:
|
|||||||
/** Determine if the caller needs to call a handshaking function. */
|
/** Determine if the caller needs to call a handshaking function. */
|
||||||
bool needs_handshake ()
|
bool needs_handshake ()
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
return m_needs_handshake;
|
return m_needs_handshake;
|
||||||
#else
|
|
||||||
if (is_server ())
|
|
||||||
{
|
|
||||||
// If the PROXY flag is on, we need that first
|
|
||||||
if (m_flags.set (Flag::proxy))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (m_flags.any_set (Flag::ssl | Flag::ssl_required))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (is_client ())
|
|
||||||
{
|
|
||||||
// Client sends PROXY on the initial connect
|
|
||||||
// before We even get to this function.
|
|
||||||
|
|
||||||
if (m_flags.set (Flag::ssl))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bassert (is_peer ());
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code handshake (Socket::handshake_type type, error_code& ec)
|
error_code handshake (Socket::handshake_type type, error_code& ec)
|
||||||
@@ -197,15 +170,25 @@ protected:
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
|
bassert (m_context.isNull ());
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (init_handshake (type, ec))
|
if (init_handshake (type, ec))
|
||||||
return stream ().async_handshake (type,
|
{
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
// The original handler has already been wrapped for us
|
||||||
return get_io_service ().post (CompletionCall (
|
// so set the context and indicate the beginning of the
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler), ec));
|
// composed operation.
|
||||||
|
//
|
||||||
|
//handler.beginComposed ();
|
||||||
|
//m_context = handler.getContext ();
|
||||||
|
return stream ().async_handshake (type, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), ec));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||||
@@ -217,15 +200,15 @@ protected:
|
|||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (error_code, std::size_t))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
|
||||||
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
async_handshake (handshake_type type, ConstBuffers const& buffers,
|
||||||
BOOST_ASIO_MOVE_ARG(TransferCall) handler)
|
BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (init_handshake (type, ec))
|
if (init_handshake (type, ec))
|
||||||
return stream ().async_handshake (type, buffers,
|
return stream ().async_handshake (type, buffers,
|
||||||
BOOST_ASIO_MOVE_CAST(TransferCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
return get_io_service ().post (CompletionCall (handler, ec, 0));
|
return get_io_service ().post (HandlerCall (handler, ec, 0));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -240,23 +223,23 @@ protected:
|
|||||||
return handshake_error (ec);
|
return handshake_error (ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (error_code))
|
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
|
||||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
|
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (m_needs_shutdown)
|
if (m_needs_shutdown)
|
||||||
{
|
{
|
||||||
if (m_needs_shutdown_stream)
|
if (m_needs_shutdown_stream)
|
||||||
return stream ().async_shutdown (
|
return stream ().async_shutdown (
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ec = handshake_error ();
|
ec = handshake_error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_io_service ().post (CompletionCall (
|
return get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler),
|
||||||
ec));
|
ec));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,14 +551,14 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_async_detect (LogicType& logic, error_code const& ec,
|
void on_async_detect (LogicType& logic, error_code const& ec,
|
||||||
ConstBuffers const& buffers, ErrorCall const& origHandler)
|
ConstBuffers const& buffers, HandlerCall const& origHandler)
|
||||||
{
|
{
|
||||||
m_owner->on_async_detect_proxy (logic, ec, buffers, origHandler);
|
m_owner->on_async_detect_proxy (logic, ec, buffers, origHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||||
void on_async_detect (LogicType& logic, error_code const& ec,
|
void on_async_detect (LogicType& logic, error_code const& ec,
|
||||||
ConstBuffers const& buffers, TransferCall const& origHandler)
|
ConstBuffers const& buffers, HandlerCall const& origHandler)
|
||||||
{
|
{
|
||||||
m_owner->on_async_detect_proxy (logic, ec, buffers, origHandler);
|
m_owner->on_async_detect_proxy (logic, ec, buffers, origHandler);
|
||||||
}
|
}
|
||||||
@@ -620,7 +603,7 @@ protected:
|
|||||||
|
|
||||||
// origHandler cannot be a reference since it gets move-copied
|
// origHandler cannot be a reference since it gets move-copied
|
||||||
void on_async_detect_proxy (HandshakeDetectLogicPROXY& logic,
|
void on_async_detect_proxy (HandshakeDetectLogicPROXY& logic,
|
||||||
error_code ec, ConstBuffers const& buffers, ErrorCall origHandler)
|
error_code ec, ConstBuffers const& buffers, HandlerCall origHandler)
|
||||||
{
|
{
|
||||||
if (! ec)
|
if (! ec)
|
||||||
{
|
{
|
||||||
@@ -646,14 +629,14 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
BOOST_ASIO_MOVE_CAST(ErrorCall)(origHandler), ec));
|
BOOST_ASIO_MOVE_CAST(HandlerCall)(origHandler), ec));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||||
// origHandler cannot be a reference since it gets move-copied
|
// origHandler cannot be a reference since it gets move-copied
|
||||||
void on_async_detect_proxy (HandshakeDetectLogicPROXY& logic,
|
void on_async_detect_proxy (HandshakeDetectLogicPROXY& logic,
|
||||||
error_code const& ec, ConstBuffers const& buffers, TransferCall origHandler)
|
error_code const& ec, ConstBuffers const& buffers, HandlerCall origHandler)
|
||||||
{
|
{
|
||||||
std::size_t bytes_transferred = 0;
|
std::size_t bytes_transferred = 0;
|
||||||
|
|
||||||
@@ -699,7 +682,7 @@ protected:
|
|||||||
|
|
||||||
// origHandler cannot be a reference since it gets move-copied
|
// origHandler cannot be a reference since it gets move-copied
|
||||||
void on_async_detect_ssl (HandshakeDetectLogicSSL3& logic,
|
void on_async_detect_ssl (HandshakeDetectLogicSSL3& logic,
|
||||||
error_code const& ec, ConstBuffers const& buffers, ErrorCall origHandler)
|
error_code const& ec, ConstBuffers const& buffers, HandlerCall origHandler)
|
||||||
{
|
{
|
||||||
if (! ec)
|
if (! ec)
|
||||||
{
|
{
|
||||||
@@ -718,14 +701,14 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is this a continuation?
|
// Is this a continuation?
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (HandlerCall::Post (),
|
||||||
origHandler, ec));
|
origHandler, ec));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||||
// origHandler cannot be a reference since it gets move-copied
|
// origHandler cannot be a reference since it gets move-copied
|
||||||
void on_async_detect_ssl (HandshakeDetectLogicSSL3& logic,
|
void on_async_detect_ssl (HandshakeDetectLogicSSL3& logic,
|
||||||
error_code const& ec, ConstBuffers const& buffers, TransferCall origHandler)
|
error_code const& ec, ConstBuffers const& buffers, HandlerCall origHandler)
|
||||||
{
|
{
|
||||||
std::size_t bytes_transferred = 0;
|
std::size_t bytes_transferred = 0;
|
||||||
|
|
||||||
@@ -748,7 +731,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is this a continuation?
|
// Is this a continuation?
|
||||||
get_io_service ().post (CompletionCall (
|
get_io_service ().post (HandlerCall (
|
||||||
origHandler, ec, bytes_transferred));
|
origHandler, ec, bytes_transferred));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -775,14 +758,14 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_async_detect (LogicType& logic, error_code const& ec,
|
void on_async_detect (LogicType& logic, error_code const& ec,
|
||||||
ConstBuffers const& buffers, ErrorCall const& origHandler)
|
ConstBuffers const& buffers, HandlerCall const& origHandler)
|
||||||
{
|
{
|
||||||
m_owner->on_async_detect_ssl (logic, ec, buffers, origHandler);
|
m_owner->on_async_detect_ssl (logic, ec, buffers, origHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
#if BEAST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||||
void on_async_detect (LogicType& logic, error_code const& ec,
|
void on_async_detect (LogicType& logic, error_code const& ec,
|
||||||
ConstBuffers const& buffers, TransferCall const& origHandler)
|
ConstBuffers const& buffers, HandlerCall const& origHandler)
|
||||||
{
|
{
|
||||||
m_owner->on_async_detect_ssl (logic, ec, buffers, origHandler);
|
m_owner->on_async_detect_ssl (logic, ec, buffers, origHandler);
|
||||||
}
|
}
|
||||||
@@ -821,6 +804,7 @@ private:
|
|||||||
StreamSocket m_next_layer;
|
StreamSocket m_next_layer;
|
||||||
ScopedPointer <Socket> m_stream;
|
ScopedPointer <Socket> m_stream;
|
||||||
boost::asio::io_service::strand m_strand;
|
boost::asio::io_service::strand m_strand;
|
||||||
|
HandlerCall::Context m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user