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

Method async_accept

implementation/endpoints/src/local_acceptor_uds_impl.cpp:96–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void local_acceptor_uds_impl::async_accept(connection_handler _handler) {
97 std::scoped_lock const lock{mtx_};
98 // tmp_socket is a `shared_ptr` due to the `std::function` below which requires everything to be copyable
99 std::shared_ptr<uds_socket> tmp_socket = abstract_socket_factory::get()->create_uds_socket(io_);
100 // Use the peer-endpoint overload so the remote address is captured by the kernel at accept() time.
101 // If the client disconnects immediately after connecting, calling remote_endpoint() on the socket
102 // in the callback would fail
103 auto tmp_remote_ep = std::make_shared<endpoint>();
104 uds_socket& socket_ref = *tmp_socket;
105 acceptor_->async_accept(socket_ref, *tmp_remote_ep,
106 [weak_self = weak_from_this(), h = std::move(_handler), tmp_socket, tmp_remote_ep](auto const& _ec) {
107 if (auto self = weak_self.lock(); self) {
108 self->accept_cbk(_ec, std::move(h), tmp_socket, tmp_remote_ep);
109 }
110 });
111}
112
113port_t local_acceptor_uds_impl::get_local_port() {
114 return VSOMEIP_SEC_PORT_UNUSED;

Callers

nothing calls this directly

Calls 3

accept_cbkMethod · 0.95
lockMethod · 0.80
create_uds_socketMethod · 0.45

Tested by

no test coverage detected