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

Method stop

implementation/endpoints/src/tcp_server_endpoint_impl.cpp:140–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void tcp_server_endpoint_impl::stop(bool /*_due_to_error*/) {
141 VSOMEIP_INFO_P << instance_name_;
142
143 connections_t conns;
144
145 {
146 std::scoped_lock first_lock(acceptor_mutex_);
147
148 if (acceptor_->is_open()) {
149 boost::system::error_code its_error;
150 acceptor_->close(its_error);
151 VSOMEIP_INFO_P << instance_name_ << "Acceptor closed, " << its_error.message();
152 }
153
154 std::scoped_lock second_lock(connections_mutex_);
155
156 for (const auto& [_, c] : connections_) {
157 c->stop();
158 }
159
160 conns = connections_;
161 connections_.clear();
162 }
163
164 conns.clear(); // release outside of held mutexes; `tsei::~connection` is non-trivial
165
166 VSOMEIP_INFO_P << instance_name_ << "Done";
167}
168
169bool tcp_server_endpoint_impl::send_to(const std::shared_ptr<endpoint_definition> _target, const byte_t* _data, uint32_t _size) {
170 std::scoped_lock its_lock(mutex_);

Callers 1

remove_connectionMethod · 0.45

Calls 4

messageMethod · 0.80
is_openMethod · 0.45
closeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected