| 149 | } |
| 150 | } |
| 151 | void local_socket_tcp_impl::async_send(std::vector<uint8_t> _data, write_handler _w_handle) { |
| 152 | std::unique_lock lock{socket_mtx_}; |
| 153 | if (socket_->is_open()) { |
| 154 | // ensure the memory is kept alive as long as the callback hasn't been invoked |
| 155 | auto buffer = boost::asio::buffer(_data); |
| 156 | socket_->async_write({buffer}, [d = std::move(_data), handler = std::move(_w_handle)](auto const& _ec, size_t _bytes) mutable { |
| 157 | handler(_ec, _bytes, std::move(d)); |
| 158 | }); |
| 159 | } else { |
| 160 | boost::asio::post(io_context_, |
| 161 | [h = std::move(_w_handle), d = std::move(_data)]() mutable { h(boost::asio::error::fault, 0, std::move(d)); }); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | std::string const& local_socket_tcp_impl::to_string() const { |
| 166 | return name_; |
nothing calls this directly
no test coverage detected