| 273 | } |
| 274 | |
| 275 | std::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 | |
| 307 | client_t endpoint_manager_base::get_client_id() const { |
| 308 | return host_.get_client_id(); |
no test coverage detected