[asio-users] A possible patch to enable sendmmsg / recvmmsg (in progress)
Brought to you by:
chris_kohlhoff
From: Virgilio F. <vir...@gm...> - 2023-01-10 20:27:57
|
I'm finalizing writing a patch that enables sendmmsg / recvmmsg on supported operating systems (Linux, [Free/Net/Open]BDS, AIX, Blackberry QNX Neutrino). The syscalls are implemented in reactive_socket_service backend only (the io_uring backend on Linux does not support sendmmsg / recvmmsg yet). The config.hpp has macros for forcible disable those calls, and detect supported operating system compiler macros. New methods were developed for (send/send_to/receive/receive_from) suffixed with '_multiple_buffer_sequence' that accepts a multiple_buffer_sequence class (backed by asio::detail::array<multiple_buffer_sequence_op, N> or std::vector<multiple_buffer_sequence_op>) and a multiple_buffer_sequence_adapter that convert ops to struct mmsghdr* for sendmmsg/recvmmsg. The multiple_buffer_sequence implementations are basically a collection of multiple_buffer_sequence_op instances that represents each socket operation . <code> buffer_sequence_type buffer_sequence_; buffer_sequence_adapter_type buffer_sequence_adapter_; endpoint_type endpoint_; bool completed_; socket_base::message_flags flags_; std::size_t bytes_transferred_; asio::error_code error_code_; </code> The multiple_buffer_sequence implementations has full container support, iterators, and support Mutable and Const buffer sequences. The patch is near a first working version (need to finalize work on handlers yet), but I made the code available for review, scrutiny and suggestions. The source code is in my github repo ( https://github.com/virgiliofornazin/asio), on branch feature/multiple_datagram_buffers_sequence-io-sendmmsg-recvmmsg ( full URL: https://github.com/chriskohlhoff/asio/compare/master...virgiliofornazin:asio:feature/multiple_datagram_buffers_sequence-io-sendmmsg-recvmmsg ) |