summaryrefslogtreecommitdiff
path: root/boost/asio/detail/winrt_resolver_service.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/detail/winrt_resolver_service.hpp')
-rw-r--r--boost/asio/detail/winrt_resolver_service.hpp65
1 files changed, 40 insertions, 25 deletions
diff --git a/boost/asio/detail/winrt_resolver_service.hpp b/boost/asio/detail/winrt_resolver_service.hpp
index dfd1dddeb2..30e50e4f00 100644
--- a/boost/asio/detail/winrt_resolver_service.hpp
+++ b/boost/asio/detail/winrt_resolver_service.hpp
@@ -19,10 +19,10 @@
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
-#include <boost/asio/ip/basic_resolver_iterator.hpp>
#include <boost/asio/ip/basic_resolver_query.hpp>
-#include <boost/asio/detail/addressof.hpp>
+#include <boost/asio/ip/basic_resolver_results.hpp>
#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/socket_ops.hpp>
#include <boost/asio/detail/winrt_async_manager.hpp>
#include <boost/asio/detail/winrt_resolve_op.hpp>
@@ -35,7 +35,8 @@ namespace asio {
namespace detail {
template <typename Protocol>
-class winrt_resolver_service
+class winrt_resolver_service :
+ public service_base<winrt_resolver_service<Protocol> >
{
public:
// The implementation type of the resolver. A cancellation token is used to
@@ -49,13 +50,14 @@ public:
// The query type.
typedef boost::asio::ip::basic_resolver_query<Protocol> query_type;
- // The iterator type.
- typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type;
+ // The results type.
+ typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
// Constructor.
- winrt_resolver_service(boost::asio::io_service& io_service)
- : io_service_(use_service<io_service_impl>(io_service)),
- async_manager_(use_service<winrt_async_manager>(io_service))
+ winrt_resolver_service(boost::asio::io_context& io_context)
+ : service_base<winrt_resolver_service<Protocol> >(io_context),
+ io_context_(use_service<io_context_impl>(io_context)),
+ async_manager_(use_service<winrt_async_manager>(io_context))
{
}
@@ -65,12 +67,12 @@ public:
}
// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
+ void shutdown()
{
}
// Perform any fork-related housekeeping.
- void fork_service(boost::asio::io_service::fork_event)
+ void notify_fork(boost::asio::io_context::fork_event)
{
}
@@ -79,6 +81,18 @@ public:
{
}
+ // Move-construct a new resolver implementation.
+ void move_construct(implementation_type&,
+ implementation_type&)
+ {
+ }
+
+ // Move-assign from another resolver implementation.
+ void move_assign(implementation_type&,
+ winrt_resolver_service&, implementation_type&)
+ {
+ }
+
// Destroy a resolver implementation.
void destroy(implementation_type&)
{
@@ -90,7 +104,7 @@ public:
}
// Resolve a query to a list of entries.
- iterator_type resolve(implementation_type&,
+ results_type resolve(implementation_type&,
const query_type& query, boost::system::error_code& ec)
{
try
@@ -102,9 +116,9 @@ public:
winrt_utils::string(query.service_name())), ec);
if (ec)
- return iterator_type();
+ return results_type();
- return iterator_type::create(
+ return results_type::create(
endpoint_pairs, query.hints(),
query.host_name(), query.service_name());
}
@@ -112,13 +126,13 @@ public:
{
ec = boost::system::error_code(e->HResult,
boost::system::system_category());
- return iterator_type();
+ return results_type();
}
}
// Asynchronously resolve a query to a list of entries.
template <typename Handler>
- void async_resolve(implementation_type&,
+ void async_resolve(implementation_type& impl,
const query_type& query, Handler& handler)
{
bool is_continuation =
@@ -127,11 +141,12 @@ public:
// Allocate and construct an operation to wrap the handler.
typedef winrt_resolve_op<Protocol, Handler> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
- boost_asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
+ op::ptr::allocate(handler), 0 };
p.p = new (p.v) op(query, handler);
- BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve"));
+ BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ *p.p, "resolver", &impl, 0, "async_resolve"));
+ (void)impl;
try
{
@@ -145,17 +160,17 @@ public:
{
p.p->ec_ = boost::system::error_code(
e->HResult, boost::system::system_category());
- io_service_.post_immediate_completion(p.p, is_continuation);
+ io_context_.post_immediate_completion(p.p, is_continuation);
p.v = p.p = 0;
}
}
// Resolve an endpoint to a list of entries.
- iterator_type resolve(implementation_type&,
+ results_type resolve(implementation_type&,
const endpoint_type&, boost::system::error_code& ec)
{
ec = boost::asio::error::operation_not_supported;
- return iterator_type();
+ return results_type();
}
// Asynchronously resolve an endpoint to a list of entries.
@@ -164,13 +179,13 @@ public:
const endpoint_type&, Handler& handler)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
- const iterator_type iterator;
- io_service_.get_io_service().post(
- detail::bind_handler(handler, ec, iterator));
+ const results_type results;
+ io_context_.get_io_context().post(
+ detail::bind_handler(handler, ec, results));
}
private:
- io_service_impl& io_service_;
+ io_context_impl& io_context_;
winrt_async_manager& async_manager_;
};