| 222 | template bool local_endpoint::send<protocol::command_header>(protocol::command_header const&); |
| 223 | |
| 224 | void local_endpoint::connect_unlock() { |
| 225 | if (state_ != state_e::INIT) { |
| 226 | return; |
| 227 | } |
| 228 | auto config = configuration_.lock(); |
| 229 | if (!config) { |
| 230 | return; |
| 231 | } |
| 232 | set_state_unlocked(state_e::CONNECTING); |
| 233 | boost::system::error_code ec; |
| 234 | socket_->prepare_connect(*config, ec); |
| 235 | if (ec) { |
| 236 | VSOMEIP_WARNING_P << "Handling error: " << ec.message() << ", " << socket_->to_string(); |
| 237 | // post to ensure same call semantics as if enqueued as a reaction. This avoids unlocking the mutex (as connect_cbk needs to be able |
| 238 | // to call escalate) |
| 239 | boost::asio::post(io_, [weak_self = weak_from_this(), ec] { |
| 240 | if (auto self = weak_self.lock(); self) { |
| 241 | self->connect_cbk(ec); |
| 242 | } |
| 243 | }); |
| 244 | return; |
| 245 | } |
| 246 | if (!connecting_timebox_) { |
| 247 | connecting_timebox_ = |
| 248 | timer::create(io_, std::chrono::milliseconds(VSOMEIP_DEFAULT_CONNECTING_TIMEOUT), [weak_self = weak_from_this()] { |
| 249 | if (auto self = weak_self.lock(); self) { |
| 250 | self->connect_cbk(boost::asio::error::timed_out); |
| 251 | } |
| 252 | return false; |
| 253 | }); |
| 254 | } |
| 255 | connecting_timebox_->start(); |
| 256 | socket_->async_connect([weak_self = weak_from_this()](auto const& _ec) { |
| 257 | if (auto self = weak_self.lock(); self) { |
| 258 | self->connect_cbk(_ec); |
| 259 | } |
| 260 | }); |
| 261 | } |
| 262 | |
| 263 | void local_endpoint::stop_internal(std::unique_lock<std::mutex>& lock, bool _due_to_error) { |
| 264 | if (state_ == state_e::STOPPED) { |
no test coverage detected