Skip to content

Commit 93ed48b

Browse files
committed
Some async operations that missed getting the async_result treatment.
1 parent e9b7b07 commit 93ed48b

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

asio/include/asio/seq_packet_socket_service.hpp

+20-5
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,20 @@ class seq_packet_socket_service
313313

314314
/// Start an asynchronous send.
315315
template <typename ConstBufferSequence, typename WriteHandler>
316-
void async_send(implementation_type& impl,
316+
ASIO_INITFN_RESULT_TYPE(WriteHandler,
317+
void (asio::error_code, std::size_t))
318+
async_send(implementation_type& impl,
317319
const ConstBufferSequence& buffers,
318320
socket_base::message_flags flags,
319321
ASIO_MOVE_ARG(WriteHandler) handler)
320322
{
321-
service_impl_.async_send(impl, buffers, flags,
323+
detail::async_result_init<
324+
WriteHandler, void (asio::error_code, std::size_t)> init(
322325
ASIO_MOVE_CAST(WriteHandler)(handler));
326+
327+
service_impl_.async_send(impl, buffers, flags, init.handler);
328+
329+
return init.result.get();
323330
}
324331

325332
/// Receive some data from the peer.
@@ -334,13 +341,21 @@ class seq_packet_socket_service
334341

335342
/// Start an asynchronous receive.
336343
template <typename MutableBufferSequence, typename ReadHandler>
337-
void async_receive(implementation_type& impl,
344+
ASIO_INITFN_RESULT_TYPE(ReadHandler,
345+
void (asio::error_code, std::size_t))
346+
async_receive(implementation_type& impl,
338347
const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
339348
socket_base::message_flags& out_flags,
340349
ASIO_MOVE_ARG(ReadHandler) handler)
341350
{
342-
service_impl_.async_receive_with_flags(impl, buffers, in_flags,
343-
out_flags, ASIO_MOVE_CAST(ReadHandler)(handler));
351+
detail::async_result_init<
352+
ReadHandler, void (asio::error_code, std::size_t)> init(
353+
ASIO_MOVE_CAST(ReadHandler)(handler));
354+
355+
service_impl_.async_receive_with_flags(impl,
356+
buffers, in_flags, out_flags, init.handler);
357+
358+
return init.result.get();
344359
}
345360

346361
private:

0 commit comments

Comments
 (0)