| 89 | } |
| 90 | |
| 91 | void local_socket_uds_impl::async_send(std::vector<uint8_t> _data, write_handler _w_handle) { |
| 92 | std::unique_lock lock{socket_mtx_}; |
| 93 | if (socket_->is_open()) { |
| 94 | // ensure the memory is kept alive as long as the callback hasn't been invoked |
| 95 | auto buffer = boost::asio::buffer(_data); |
| 96 | socket_->async_write(buffer, [d = std::move(_data), handler = std::move(_w_handle)](auto const& _ec, size_t _bytes) mutable { |
| 97 | handler(_ec, _bytes, std::move(d)); |
| 98 | }); |
| 99 | } else { |
| 100 | boost::asio::post(io_context_, |
| 101 | [h = std::move(_w_handle), d = std::move(_data)]() mutable { h(boost::asio::error::fault, 0, std::move(d)); }); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | std::string const& local_socket_uds_impl::to_string() const { |
| 106 | return name_; |
no test coverage detected