void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef reactive_socket_recvfrom_op<MutableBufferSequence, endpoint_type, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; int protocol = impl.protocol_.type(); p.p = new (p.v) op(impl.socket_, protocol, buffers, sender_endpoint, flags, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive_from")); start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, p.p, is_continuation, true, false); p.v = p.p = 0; }
void async_receive_from(implementation_type& impl, const null_buffers&, endpoint_type& sender_endpoint, socket_base::message_flags flags, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive_from(null_buffers)")); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, p.p, is_continuation, false, false); p.v = p.p = 0; }
void async_wait(base_implementation_type& impl, socket_base::wait_type w, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef win_iocp_wait_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_wait")); switch (w) { case socket_base::wait_read: start_null_buffers_receive_op(impl, 0, p.p); break; case socket_base::wait_write: start_reactor_op(impl, select_reactor::write_op, p.p); break; case socket_base::wait_error: start_reactor_op(impl, select_reactor::except_op, p.p); break; default: p.p->ec_ = asio::error::invalid_argument; iocp_service_.post_immediate_completion(p.p, is_continuation); break; } p.v = p.p = 0; }
void async_wait( implementation_type& impl, Handler& handler ) { // Allocate and construct an operation to wrap the handler. typedef wait_handler<Handler> op; typename op::ptr p = {asio::detail::addressof( handler ), asio_handler_alloc_helpers::allocate( sizeof( op ), handler ), 0}; p.p = new ( p.v ) op( handler ); ASIO_HANDLER_CREATION( ( p.p, "object_handle", &impl, "async_wait" ) ); start_wait_op( impl, p.p ); p.v = p.p = 0; }
void win_iocp_io_service::post(Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef completion_handler<Handler> op; typename op::ptr p = { boost::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); post_immediate_completion(p.p); p.v = p.p = 0; }
void async_wait(implementation_type& impl, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef wait_handler<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "object_handle", &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "async_wait")); start_wait_op(impl, p.p); p.v = p.p = 0; }
void async_send_to(implementation_type& impl, const null_buffers&, const endpoint_type&, socket_base::message_flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_null_buffers_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_send_to(null_buffers)")); start_reactor_op(impl, select_reactor::write_op, p.p); p.v = p.p = 0; }
void async_resolve(implementation_type& impl, const query_type& query, Handler& handler, const IoExecutor& io_ex) { // Allocate and construct an operation to wrap the handler. typedef resolve_query_op<Protocol, Handler, IoExecutor> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl, query, scheduler_, handler, io_ex); ASIO_HANDLER_CREATION((scheduler_.context(), *p.p, "resolver", &impl, 0, "async_resolve")); start_resolve_op(p.p); p.v = p.p = 0; }
void async_resolve(implementation_type& impl, const query_type& query, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef resolve_op<Protocol, Handler> op; typename op::ptr p = { boost::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl, query, io_service_impl_, handler); ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve")); start_resolve_op(p.p); p.v = p.p = 0; }
void async_receive(base_implementation_type& impl, const null_buffers&, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_null_buffers_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive(null_buffers)")); start_null_buffers_receive_op(impl, flags, p.p); p.v = p.p = 0; }
void async_read_some(implementation_type& impl, const null_buffers&, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; typename op::ptr p = { boost::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some(null_buffers)")); start_op(impl, reactor::read_op, p.p, false, false); p.v = p.p = 0; }
void async_connect(implementation_type& impl, const endpoint_type& peer_endpoint, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_connect_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_connect")); start_connect_op(impl, impl.protocol_.family(), impl.protocol_.type(), peer_endpoint.data(), static_cast<int>(peer_endpoint.size()), p.p); p.v = p.p = 0; }
void async_wait(implementation_type& impl, Handler handler) { // Allocate and construct an operation to wrap the handler. typedef wait_handler<Handler> op; typename op::ptr p = { boost::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); impl.might_have_pending_waits = true; ASIO_HANDLER_CREATION((p.p, "deadline_timer", &impl, "async_wait")); scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p); p.v = p.p = 0; }
void async_wait(implementation_type& impl, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef wait_handler<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); impl.might_have_pending_waits = true; ASIO_HANDLER_CREATION((scheduler_.context(), *p.p, "deadline_timer", &impl, 0, "async_wait")); scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p); p.v = p.p = 0; }
void strand_service::post(strand_service::implementation_type& impl, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef completion_handler<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "strand", impl, "post")); do_post(impl, p.p, is_continuation); p.v = p.p = 0; }
void async_read_some(implementation_type& impl, const MutableBufferSequence& buffers, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef descriptor_read_op<MutableBufferSequence, Handler> op; typename op::ptr p = { boost::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.descriptor_, buffers, handler); ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some")); start_op(impl, reactor::read_op, p.p, true, buffer_sequence_adapter<asio::mutable_buffer, MutableBufferSequence>::all_empty(buffers)); p.v = p.p = 0; }
void async_connect(implementation_type& impl, const endpoint_type& peer_endpoint, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef winrt_socket_connect_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "socket", &impl, 0, "async_connect")); start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation); p.v = p.p = 0; }
void async_send_to(implementation_type& impl, const null_buffers&, const endpoint_type&, socket_base::message_flags, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef reactive_null_buffers_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to(null_buffers)")); start_op(impl, reactor::write_op, p.p, is_continuation, false, false); p.v = p.p = 0; }
void async_accept(implementation_type& impl, Socket& peer, endpoint_type* peer_endpoint, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef reactive_socket_accept_op<Socket, Protocol, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.socket_, impl.state_, peer, impl.protocol_, peer_endpoint, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept")); start_accept_op(impl, p.p, is_continuation, peer.is_open()); p.v = p.p = 0; }
void async_receive_with_flags(base_implementation_type& impl, const MutableBufferSequence& buffers, socket_base::message_flags in_flags, socket_base::message_flags& out_flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_receive_with_flags")); buffer_sequence_adapter<asio::mutable_buffer, MutableBufferSequence> bufs(buffers); start_receive_op(impl, bufs.buffers(), bufs.count(), in_flags, false, p.p); p.v = p.p = 0; }
void async_receive_from(implementation_type& impl, const null_buffers&, endpoint_type& sender_endpoint, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_null_buffers_op<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_receive_from(null_buffers)")); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); start_null_buffers_receive_op(impl, flags, p.p); p.v = p.p = 0; }
void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef reactive_socket_sendto_op<ConstBufferSequence, endpoint_type, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to")); start_op(impl, reactor::write_op, p.p, is_continuation, true, false); p.v = p.p = 0; }
void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endp, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_recvfrom_op< MutableBufferSequence, endpoint_type, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_receive_from")); buffer_sequence_adapter<asio::mutable_buffer, MutableBufferSequence> bufs(buffers); start_receive_from_op(impl, bufs.buffers(), bufs.count(), sender_endp.data(), flags, &p.p->endpoint_size(), p.p); p.v = p.p = 0; }
void async_accept(implementation_type& impl, Socket& peer, endpoint_type* peer_endpoint, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_accept_op<Socket, protocol_type, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; bool enable_connection_aborted = (impl.state_ & socket_ops::enable_connection_aborted) != 0; p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_, peer_endpoint, enable_connection_aborted, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_accept")); start_accept_op(impl, peer.is_open(), p.p->new_socket(), impl.protocol_.family(), impl.protocol_.type(), impl.protocol_.protocol(), p.p->output_buffer(), p.p->address_length(), p.p); p.v = p.p = 0; }
void async_receive(base_implementation_type& impl, const MutableBufferSequence& buffers, socket_base::message_flags flags, Handler& handler) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef winrt_socket_recv_op<MutableBufferSequence, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(buffers, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); start_receive_op(impl, buffer_sequence_adapter<asio::mutable_buffer, MutableBufferSequence>::first(buffers), flags, p.p, is_continuation); p.v = p.p = 0; }
void async_receive(base_implementation_type& impl, const MutableBufferSequence& buffers, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_recv_op<MutableBufferSequence, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler); ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); buffer_sequence_adapter<asio::mutable_buffer, MutableBufferSequence> bufs(buffers); start_receive_op(impl, bufs.buffers(), bufs.count(), flags, (impl.state_ & socket_ops::stream_oriented) != 0 && bufs.all_empty(), p.p); p.v = p.p = 0; }
void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_send_to")); buffer_sequence_adapter<asio::const_buffer, ConstBufferSequence> bufs(buffers); start_send_to_op(impl, bufs.buffers(), bufs.count(), destination.data(), static_cast<int>(destination.size()), flags, p.p); p.v = p.p = 0; }
void async_send(base_implementation_type& impl, const ConstBufferSequence& buffers, socket_base::message_flags flags, Handler& handler) { // Allocate and construct an operation to wrap the handler. typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); ASIO_HANDLER_CREATION((io_context_, *p.p, "socket", &impl, impl.socket_, "async_send")); buffer_sequence_adapter<asio::const_buffer, ConstBufferSequence> bufs(buffers); start_send_op(impl, bufs.buffers(), bufs.count(), flags, (impl.state_ & socket_ops::stream_oriented) != 0 && bufs.all_empty(), p.p); p.v = p.p = 0; }
void task_io_service::dispatch(Handler& handler) { if (thread_call_stack::contains(this)) { fenced_block b(fenced_block::full); asio_handler_invoke_helpers::invoke(handler, handler); } else { // Allocate and construct an operation to wrap the handler. typedef completion_handler<Handler> op; typename op::ptr p = { asio::detail::addressof(handler), asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); do_dispatch(p.p); p.v = p.p = 0; } }
void async_send(base_implementation_type& impl, const ConstBufferSequence& buffers, socket_base::message_flags flags, Handler& handler, const IoExecutor& io_ex) { bool is_continuation = asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef winrt_socket_send_op<ConstBufferSequence, Handler, IoExecutor> op; typename op::ptr p = { asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(buffers, handler, io_ex); ASIO_HANDLER_CREATION((scheduler_.context(), *p.p, "socket", &impl, 0, "async_send")); start_send_op(impl, buffer_sequence_adapter<asio::const_buffer, ConstBufferSequence>::first(buffers), flags, p.p, is_continuation); p.v = p.p = 0; }