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

Method stop

implementation/endpoints/src/endpoint_manager_impl.cpp:78–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void endpoint_manager_impl::stop() {
79 VSOMEIP_INFO_P << "called";
80
81 clear_routing_endpoints();
82
83 // stop boardnet endpoints
84 std::vector<std::shared_ptr<boardnet_endpoint>> endpoints;
85
86 {
87 std::scoped_lock its_lock{endpoint_mutex_};
88
89 for (const auto& [its_address, ports] : client_endpoints_) {
90 for (const auto& [its_port, protocols] : ports) {
91 for (const auto& [its_protocol, partitions] : protocols) {
92 for (const auto& [its_partition, its_endpoint] : partitions) {
93 endpoints.push_back(its_endpoint);
94 }
95 }
96 }
97 }
98
99 for (const auto& [its_port, protocols] : server_endpoints_) {
100 for (const auto& [its_protocol, its_endpoint] : protocols) {
101 endpoints.push_back(its_endpoint);
102 }
103 }
104 }
105
106 for (std::shared_ptr<boardnet_endpoint>& endpoint : endpoints) {
107 endpoint->stop(false);
108 }
109
110 // clear endpoints (and related state)
111 {
112 std::scoped_lock its_lock{endpoint_mutex_};
113
114 client_endpoints_.clear();
115 server_endpoints_.clear();
116 service_instances_.clear();
117 service_instances_multicast_.clear();
118 used_client_ports_.clear();
119 remote_services_.clear();
120 }
121
122 endpoints.clear();
123
124 {
125 std::scoped_lock its_guard(options_mutex_);
126 is_processing_options_ = false;
127 options_condition_.notify_one();
128 }
129
130 try {
131 options_thread_.join();
132 VSOMEIP_INFO_P << "Joined thread m_multicast " << std::hex << std::this_thread::get_id();
133 } catch (...) {
134 // Ignore exception if thread already joined
135 }

Callers 8

drop_fromMethod · 0.45
suspendMethod · 0.45
resumeMethod · 0.45

Calls 4

get_idFunction · 0.85
clearMethod · 0.45
notify_oneMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected