diff options
Diffstat (limited to 'boost/asio/detail/win_iocp_socket_connect_op.hpp')
-rw-r--r-- | boost/asio/detail/win_iocp_socket_connect_op.hpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/boost/asio/detail/win_iocp_socket_connect_op.hpp b/boost/asio/detail/win_iocp_socket_connect_op.hpp index e987c6b6c4..829597ae9c 100644 --- a/boost/asio/detail/win_iocp_socket_connect_op.hpp +++ b/boost/asio/detail/win_iocp_socket_connect_op.hpp @@ -19,11 +19,11 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/asio/detail/addressof.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/memory.hpp> #include <boost/asio/detail/reactor_op.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/error.hpp> @@ -44,12 +44,13 @@ public: { } - static bool do_perform(reactor_op* base) + static status do_perform(reactor_op* base) { win_iocp_socket_connect_op_base* o( static_cast<win_iocp_socket_connect_op_base*>(base)); - return socket_ops::non_blocking_connect(o->socket_, o->ec_); + return socket_ops::non_blocking_connect( + o->socket_, o->ec_) ? done : not_done; } socket_type socket_; @@ -67,9 +68,10 @@ public: &win_iocp_socket_connect_op::do_complete), handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { + handler_work<Handler>::start(handler_); } - static void do_complete(io_service_impl* owner, operation* base, + static void do_complete(void* owner, operation* base, const boost::system::error_code& result_ec, std::size_t /*bytes_transferred*/) { @@ -79,6 +81,7 @@ public: win_iocp_socket_connect_op* o( static_cast<win_iocp_socket_connect_op*>(base)); ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; + handler_work<Handler> w(o->handler_); if (owner) { @@ -88,7 +91,7 @@ public: ec = o->ec_; } - BOOST_ASIO_HANDLER_COMPLETION((o)); + BOOST_ASIO_HANDLER_COMPLETION((*o)); // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a @@ -106,7 +109,7 @@ public: { fenced_block b(fenced_block::half); BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); - boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + w.complete(handler, handler.handler_); BOOST_ASIO_HANDLER_INVOCATION_END; } } |