Skip to content

Commit

Permalink
Fix work counting issue in asynchronous resolver implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskohlhoff committed Jul 15, 2017
1 parent 48e7ef8 commit b8a34a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion asio/include/asio/detail/resolve_query_op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class resolve_query_op : public resolve_op
// Take ownership of the operation object.
resolve_query_op* o(static_cast<resolve_query_op*>(base));
ptr p = { asio::detail::addressof(o->handler_), o, o };
handler_work<Handler> w(o->handler_);

if (owner && owner != &o->io_context_impl_)
{
Expand All @@ -88,6 +87,9 @@ class resolve_query_op : public resolve_op
// The operation has been returned to the main io_context. The completion
// handler is ready to be delivered.

// Take ownership of the operation's outstanding work.
handler_work<Handler> w(o->handler_);

ASIO_HANDLER_COMPLETION((*o));

// Make a copy of the handler so that the memory can be deallocated
Expand Down

0 comments on commit b8a34a1

Please sign in to comment.