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

Method create_local_server

implementation/endpoints/src/endpoint_manager_base.cpp:275–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275std::shared_ptr<local_server> endpoint_manager_base::create_local_server(transport_protocol_e _transport_protocol) {
276 std::stringstream its_path;
277 its_path << utility::get_base_path(configuration_->get_network()) << std::hex << get_client_id();
278 const client_t its_client = get_client_id();
279 VSOMEIP_INFO << "Creating local server endpoint for client 0x" << hex4(its_client) << " with transport type "
280 << (_transport_protocol == transport_protocol_e::UDS ? "UDS" : "TCP") << ".";
281
282 std::shared_ptr<local_acceptor> its_acceptor;
283
284 if (_transport_protocol == transport_protocol_e::UDS) {
285 its_acceptor = create_uds_local_acceptor(its_path.str(), its_client);
286 } else {
287 its_acceptor = create_tcp_local_acceptor(its_client);
288 }
289
290 if (its_acceptor) {
291 auto token = [this] {
292 std::scoped_lock lock{mtx_};
293 return lc_token_;
294 }();
295 return std::make_shared<local_server>(
296 io_, std::move(its_acceptor), configuration_, local_message_handler_,
297 [weak_self = weak_from_this(), token](auto _ep) {
298 if (auto self = weak_self.lock(); self) {
299 self->add_local_server_endpoint(std::move(_ep), token);
300 }
301 },
302 false, get_client_env());
303 }
304 return nullptr;
305}
306
307client_t endpoint_manager_base::get_client_id() const {
308 return host_.get_client_id();

Callers 3

startMethod · 0.80
reconnectMethod · 0.80
init_receiver_sideMethod · 0.80

Calls 3

hex4Function · 0.85
lockMethod · 0.80

Tested by

no test coverage detected