summaryrefslogtreecommitdiff
path: root/boost/asio/detail/reactive_socket_sendto_op.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:11:01 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:11:01 +0900
commit3fdc3e5ee96dca5b11d1694975a65200787eab86 (patch)
tree5c1733853892b8397d67706fa453a9bd978d2102 /boost/asio/detail/reactive_socket_sendto_op.hpp
parent88e602c57797660ebe0f9e15dbd64c1ff16dead3 (diff)
downloadboost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.gz
boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.bz2
boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.zip
Imported Upstream version 1.66.0upstream/1.66.0
Diffstat (limited to 'boost/asio/detail/reactive_socket_sendto_op.hpp')
-rw-r--r--boost/asio/detail/reactive_socket_sendto_op.hpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/boost/asio/detail/reactive_socket_sendto_op.hpp b/boost/asio/detail/reactive_socket_sendto_op.hpp
index 134c767c86..47a2656e22 100644
--- a/boost/asio/detail/reactive_socket_sendto_op.hpp
+++ b/boost/asio/detail/reactive_socket_sendto_op.hpp
@@ -16,10 +16,10 @@
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
-#include <boost/asio/detail/addressof.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/reactor_op.hpp>
#include <boost/asio/detail/socket_ops.hpp>
@@ -44,7 +44,7 @@ public:
{
}
- static bool do_perform(reactor_op* base)
+ static status do_perform(reactor_op* base)
{
reactive_socket_sendto_op_base* o(
static_cast<reactive_socket_sendto_op_base*>(base));
@@ -52,10 +52,15 @@ public:
buffer_sequence_adapter<boost::asio::const_buffer,
ConstBufferSequence> bufs(o->buffers_);
- return socket_ops::non_blocking_sendto(o->socket_,
+ status result = socket_ops::non_blocking_sendto(o->socket_,
bufs.buffers(), bufs.count(), o->flags_,
o->destination_.data(), o->destination_.size(),
- o->ec_, o->bytes_transferred_);
+ o->ec_, o->bytes_transferred_) ? done : not_done;
+
+ BOOST_ASIO_HANDLER_REACTOR_OPERATION((*o, "non_blocking_sendto",
+ o->ec_, o->bytes_transferred_));
+
+ return result;
}
private:
@@ -79,17 +84,19 @@ public:
buffers, endpoint, flags, &reactive_socket_sendto_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& /*ec*/,
std::size_t /*bytes_transferred*/)
{
// Take ownership of the handler object.
reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
+ handler_work<Handler> w(o->handler_);
- 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
@@ -107,7 +114,7 @@ public:
{
fenced_block b(fenced_block::half);
BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ w.complete(handler, handler.handler_);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
}