MCPcopy Create free account
hub / github.com/COVESA/vsomeip / async_send

Method async_send

implementation/endpoints/src/local_socket_tcp_impl.cpp:151–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 }
150}
151void 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
165std::string const& local_socket_tcp_impl::to_string() const {
166 return name_;

Callers

nothing calls this directly

Calls 3

bufferClass · 0.85
is_openMethod · 0.45
async_writeMethod · 0.45

Tested by

no test coverage detected