| 490 | } |
| 491 | |
| 492 | void routing_manager_client::unregister_event(client_t _client, service_t _service, instance_t _instance, event_t _notifier, |
| 493 | bool _is_provided) { |
| 494 | |
| 495 | unregister_event_base(_client, _service, _instance, _notifier, _is_provided); |
| 496 | |
| 497 | // order matters: |
| 498 | // 1. Remove the event from the pending events |
| 499 | // 2. Try to send the unregister command |
| 500 | // Otherwise we might not send the command, but request it when entering REGISTERED |
| 501 | { |
| 502 | std::scoped_lock its_lock(pending_event_registrations_mutex_); |
| 503 | for (auto iter = pending_event_registrations_.begin(); iter != pending_event_registrations_.end();) { |
| 504 | if (iter->service_instance_.service() == _service && iter->service_instance_.instance() == _instance |
| 505 | && iter->notifier_ == _notifier && iter->is_provided_ == _is_provided) { |
| 506 | pending_event_registrations_.erase(iter); |
| 507 | break; |
| 508 | } else { |
| 509 | iter++; |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | if (state_machine_->state() == routing_client_state_e::ST_REGISTERED) { |
| 514 | |
| 515 | protocol::unregister_event_command its_command; |
| 516 | its_command.set_client(get_client()); |
| 517 | its_command.set_service(_service); |
| 518 | its_command.set_instance(_instance); |
| 519 | its_command.set_event(_notifier); |
| 520 | its_command.set_provided(_is_provided); |
| 521 | |
| 522 | std::vector<byte_t> its_buffer; |
| 523 | its_command.serialize(its_buffer); |
| 524 | std::scoped_lock its_sender_lock{sender_mutex_}; |
| 525 | if (sender_) { |
| 526 | sender_->send(&its_buffer[0], uint32_t(its_buffer.size())); |
| 527 | } else { |
| 528 | VSOMEIP_ERROR_P << "Failed due to a missing sender"; |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | void routing_manager_client::subscribe(client_t _client, service_t _service, instance_t _instance, eventgroup_t _eventgroup, |
| 534 | major_version_t _major, event_t _event, const std::shared_ptr<debounce_filter_impl_t>& _filter) { |
nothing calls this directly
no test coverage detected