Tidy up argument types for all wrappers and call sites

This commit is contained in:
Vinnie Falco
2013-08-18 03:07:12 -07:00
parent 2d04fc4641
commit d571788172
7 changed files with 80 additions and 112 deletions

View File

@@ -252,7 +252,7 @@ bool HandlerCall::isFinal () const noexcept
return m_call->getContext () == m_call.get (); return m_call->getContext () == m_call.get ();
} }
HandlerCall& HandlerCall::beginComposed () noexcept HandlerCall const& HandlerCall::beginComposed () const noexcept
{ {
// If this goes off it means that your handler is // If this goes off it means that your handler is
// already sharing a context with another handler! // already sharing a context with another handler!
@@ -263,7 +263,7 @@ HandlerCall& HandlerCall::beginComposed () noexcept
return *this; return *this;
} }
HandlerCall& HandlerCall::endComposed () noexcept HandlerCall const& HandlerCall::endComposed () const noexcept
{ {
// If this goes off it means that your handler is // If this goes off it means that your handler is
// already sharing a context with another handler! // already sharing a context with another handler!

View File

@@ -384,7 +384,7 @@ public:
@see isComposed, endComposed @see isComposed, endComposed
*/ */
HandlerCall& beginComposed () noexcept; HandlerCall const& beginComposed () const noexcept;
/** Indicate the end of a composed operation. /** Indicate the end of a composed operation.
@@ -393,7 +393,7 @@ public:
own callback, using the original handler's context. To optimize the own callback, using the original handler's context. To optimize the
strategy for calling completion handlers, call beginComposed. strategy for calling completion handlers, call beginComposed.
*/ */
HandlerCall& endComposed () noexcept; HandlerCall const& endComposed () const noexcept;
/** Invoke the wrapped handler. /** Invoke the wrapped handler.

View File

@@ -207,7 +207,7 @@ 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.
// //
m_origHandler.beginComposed (); //m_origHandler.beginComposed ();
m_context = m_origHandler.getContext (); m_context = m_origHandler.getContext ();
bassert (m_context.isNotNull ()); bassert (m_context.isNotNull ());
@@ -246,7 +246,7 @@ public:
// 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.
// //
m_origHandler.endComposed (); //m_origHandler.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);
return; return;
@@ -273,7 +273,7 @@ public:
// Error condition // Error condition
m_origHandler.endComposed (); //m_origHandler.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);
} }

View File

@@ -168,14 +168,13 @@ public:
BEAST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, void (error_code))
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, HandlerCall (HandlerCall::Accept (),
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(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(HandlerCall) handler); async_accept (Socket& peer, HandlerCall const& handler);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// //
@@ -210,13 +209,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(HandlerCall)(HandlerCall (HandlerCall::Transfer (), HandlerCall (HandlerCall::Transfer (),
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)))); BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)));
} }
virtual virtual
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler); async_read_some (MutableBuffers const& buffers, HandlerCall const& 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 +224,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(HandlerCall)(HandlerCall (HandlerCall::Transfer (), HandlerCall (HandlerCall::Transfer (),
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)))); BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
} }
virtual virtual
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler); async_write_some (ConstBuffers const& buffers, HandlerCall const& handler);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// //
@@ -274,14 +273,13 @@ public:
BEAST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (error_code))
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, HandlerCall (HandlerCall::Error (),
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(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler); async_handshake (handshake_type type, HandlerCall const& handler);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@@ -318,14 +316,13 @@ 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(HandlerCall)(HandlerCall ( HandlerCall (HandlerCall::Transfer (),
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler)))); BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler)));
} }
virtual virtual
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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, HandlerCall const& handler);
BOOST_ASIO_MOVE_ARG(HandlerCall) handler);
#endif #endif
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@@ -347,14 +344,13 @@ public:
template <class ShutdownHandler> template <class ShutdownHandler>
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler) void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
{ {
return async_shutdown ( return async_shutdown (HandlerCall (HandlerCall::Error (),
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(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler); async_shutdown (HandlerCall const& handler);
}; };
#endif #endif

View File

@@ -364,45 +364,39 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(HandlerCall) handler) async_accept (Socket& peer, HandlerCall const& 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(HandlerCall)(handler), return async_accept (peer, handler,
EnableIf <has_async_accept <this_layer_type, EnableIf <has_async_accept <this_layer_type,
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
(socket_type&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ()); (socket_type&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
} }
template <typename AcceptHandler> BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
BEAST_ASIO_INITFN_RESULT_TYPE(HandlerCall, void (error_code)) async_accept (Socket& peer, HandlerCall const& handler,
async_accept (Socket& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler,
boost::true_type) boost::true_type)
{ {
using namespace SocketWrapperMemberChecks; using namespace SocketWrapperMemberChecks;
return m_object.async_accept ( return m_object.async_accept (
native_socket <this_layer_type> (peer).get (), native_socket <this_layer_type> (peer).get (), handler);
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
} }
template <typename AcceptHandler> BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
BEAST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, void (error_code)) async_accept (Socket&, HandlerCall const& handler,
async_accept (Socket&, BOOST_ASIO_MOVE_ARG(AcceptHandler) 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<
AcceptHandler, void (error_code)> init( HandlerCall, void (error_code)> init(handler);
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
AcceptHandler (init.handler), pure_virtual_error ())); init.handler, pure_virtual_error ()));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler), handler, pure_virtual_error ()));
pure_virtual_error ()));
#endif #endif
} }
@@ -472,33 +466,27 @@ public:
(MutableBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ()); (MutableBuffers const&, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ());
} }
template <typename MutableBufferSequence, typename ReadHandler> BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
BEAST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (error_code, std::size_t)) async_read_some (MutableBuffers const& buffers, HandlerCall const& handler,
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
boost::true_type) boost::true_type)
{ {
return m_object.async_read_some (buffers, return m_object.async_read_some (buffers, handler);
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
} }
template <typename MutableBufferSequence, typename ReadHandler> BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code, std::size_t))
BEAST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (error_code, std::size_t)) async_read_some (MutableBuffers const&, HandlerCall const& handler,
async_read_some (MutableBufferSequence const&, BOOST_ASIO_MOVE_ARG(ReadHandler) 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<
ReadHandler, void (error_code, std::size_t)> init( HandlerCall, void (error_code, std::size_t)> init(handler);
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
ReadHandler (init.handler), pure_virtual_error (), 0)); init.handler, pure_virtual_error (), 0));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), handler, pure_virtual_error (), 0));
pure_virtual_error (), 0));
#endif #endif
} }
@@ -506,40 +494,36 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler) async_write_some (ConstBuffers const& buffers, HandlerCall const& handler)
{ {
using namespace SocketWrapperMemberChecks; using namespace SocketWrapperMemberChecks;
return async_write_some (buffers, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), return async_write_some (buffers, handler,
EnableIf <has_async_write_some <this_layer_type, EnableIf <has_async_write_some <this_layer_type,
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall))>::value> ()); (ConstBuffers const&, HandlerCall const&)>::value> ());
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler, async_write_some (ConstBuffers const& buffers, HandlerCall const& handler,
boost::true_type) boost::true_type)
{ {
return m_object.async_write_some (buffers, return m_object.async_write_some (buffers, handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler, async_write_some (ConstBuffers const&, HandlerCall const& 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<
HandlerCall, void (error_code, std::size_t)> init( HandlerCall, void (error_code, std::size_t)> init(handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
HandlerCall (init.handler), pure_virtual_error (), 0)); init.handler, pure_virtual_error (), 0));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), handler, pure_virtual_error (), 0));
pure_virtual_error (), 0));
#endif #endif
} }
@@ -585,39 +569,35 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler) async_handshake (handshake_type type, HandlerCall const& handler)
{ {
using namespace SocketWrapperMemberChecks; using namespace SocketWrapperMemberChecks;
return async_handshake (type, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), return async_handshake (type, handler,
EnableIf <has_async_handshake <this_layer_type, EnableIf <has_async_handshake <this_layer_type,
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
(handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ()); (handshake_type, HandlerCall const& handler)>::value> ());
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler, async_handshake (handshake_type type, HandlerCall const& handler,
boost::true_type) boost::true_type)
{ {
return m_object.async_handshake (type, return m_object.async_handshake (type, handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(HandlerCall) handler, async_handshake (handshake_type, HandlerCall const& 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<
HandlerCall, void (error_code)> init( HandlerCall, void (error_code)> init(handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
HandlerCall (init.handler), pure_virtual_error ())); init.handler, pure_virtual_error ()));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), handler, pure_virtual_error ()));
pure_virtual_error ()));
#endif #endif
} }
@@ -649,40 +629,36 @@ public:
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler) HandlerCall const& handler)
{ {
using namespace SocketWrapperMemberChecks; using namespace SocketWrapperMemberChecks;
return async_handshake (type, buffers, BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), return async_handshake (type, buffers, handler,
EnableIf <has_async_handshake <this_layer_type, EnableIf <has_async_handshake <this_layer_type,
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall, 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(HandlerCall) handler, async_handshake (handshake_type type, ConstBuffers const& buffers, HandlerCall const& handler,
boost::true_type) boost::true_type)
{ {
return m_object.async_handshake (type, buffers, return m_object.async_handshake (type, buffers, handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, 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(HandlerCall) handler, async_handshake (handshake_type, ConstBuffers const&, HandlerCall const& 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<
HandlerCall, void (error_code, std::size_t)> init( HandlerCall, void (error_code, std::size_t)> init(handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
HandlerCall (init.handler), pure_virtual_error (), 0)); init.handler, pure_virtual_error (), 0));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), handler, pure_virtual_error (), 0));
pure_virtual_error (), 0));
#endif #endif
} }
@@ -713,40 +689,36 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
void async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler) void async_shutdown (HandlerCall const& handler)
{ {
using namespace SocketWrapperMemberChecks; using namespace SocketWrapperMemberChecks;
return async_shutdown (BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), return async_shutdown (handler,
EnableIf <has_async_shutdown <this_layer_type, EnableIf <has_async_shutdown <this_layer_type,
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
(BOOST_ASIO_MOVE_ARG(HandlerCall))>::value> ()); (HandlerCall const& handler)>::value> ());
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) 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 (handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
} }
BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code)) BEAST_ASIO_INITFN_RESULT_TYPE_MEMBER(HandlerCall, void (error_code))
async_shutdown (BOOST_ASIO_MOVE_ARG(HandlerCall) handler, async_shutdown (HandlerCall const& 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<
HandlerCall, void (error_code, std::size_t)> init( HandlerCall, void (error_code, std::size_t)> init(handler);
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler));
// init.handler is copied
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
HandlerCall (init.handler), pure_virtual_error ())); init.handler, pure_virtual_error ()));
return init.result.get(); return init.result.get();
#else #else
get_io_service ().post (HandlerCall (HandlerCall::Post (), get_io_service ().post (HandlerCall (HandlerCall::Post (),
BOOST_ASIO_MOVE_CAST(HandlerCall)(handler), handler, pure_virtual_error ()));
pure_virtual_error ()));
#endif #endif
} }

View File

@@ -226,8 +226,8 @@ public:
testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy); testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy);
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl_required); testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl_required);
// testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl); testProxyFlags <Protocol> (MultiSocket::Flag::proxy, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
// testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl); testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl, MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
} }
void runTest () void runTest ()

View File

@@ -183,7 +183,7 @@ protected:
// composed operation. // composed operation.
// //
//handler.beginComposed (); //handler.beginComposed ();
//m_context = handler.getContext (); m_context = handler.getContext ();
return stream ().async_handshake (type, handler); return stream ().async_handshake (type, handler);
} }