Skip to content

Commit

Permalink
vsomeip 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juergengehring committed Jan 25, 2018
1 parent e20aff9 commit ba05080
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changes
=======

v2.8.0
- Change behaviour of register_subscription_status_handler method of
the application interface: Registered handlers will only be called
if the subscription was accepted by the remote side.
- Add 2nd register_subscription_status_handler method to application
interface with additional flag to enable calling of the registered
handler if the subscription is rejected by the remote side.

v.2.7.3
- Fix deadlock when stopping client endpoints to remote services
- Fix deadlock during construction of Subscribe Eventgroup entries
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_minimum_required (VERSION 2.8.12)
project (vsomeip)

set (VSOMEIP_MAJOR_VERSION 2)
set (VSOMEIP_MINOR_VERSION 7)
set (VSOMEIP_PATCH_VERSION 3)
set (VSOMEIP_MINOR_VERSION 8)
set (VSOMEIP_PATCH_VERSION 0)
set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION})
set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in
set (CMAKE_VERBOSE_MAKEFILE off)
Expand Down
5 changes: 4 additions & 1 deletion implementation/runtime/include/application_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class application_impl: public application,

VSOMEIP_EXPORT void clear_all_handler();

VSOMEIP_EXPORT void register_subscription_status_handler(service_t _service,
instance_t _instance, eventgroup_t _eventgroup, event_t _event,
subscription_status_handler_t _handler, bool _is_selective);
private:
//
// Types
Expand Down Expand Up @@ -369,7 +372,7 @@ class application_impl: public application,
bool stopped_called_;

std::map<service_t, std::map<instance_t, std::map<eventgroup_t,
std::map<event_t, subscription_status_handler_t > > > > subscription_status_handlers_;
std::map<event_t, std::pair<subscription_status_handler_t, bool> > > > > subscription_status_handlers_;
std::mutex subscription_status_handlers_mutex_;

std::mutex subscriptions_state_mutex_;
Expand Down
42 changes: 33 additions & 9 deletions implementation/runtime/src/application_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,11 +899,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t
if (found_eventgroup != found_instance->second.end()) {
auto found_event = found_eventgroup->second.find(_event);
if (found_event != found_eventgroup->second.end()) {
handlers.push_back(found_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(found_event->second.first);
}
} else {
auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
if (its_any_event != found_eventgroup->second.end()) {
handlers.push_back(its_any_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(its_any_event->second.first);
}
}
}
}
Expand All @@ -914,11 +918,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t
if (found_eventgroup != found_instance->second.end()) {
auto found_event = found_eventgroup->second.find(_event);
if (found_event != found_eventgroup->second.end()) {
handlers.push_back(found_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(found_event->second.first);
}
} else {
auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
if (its_any_event != found_eventgroup->second.end()) {
handlers.push_back(its_any_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(its_any_event->second.first);
}
}
}
}
Expand All @@ -932,11 +940,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t
if (found_eventgroup != found_instance->second.end()) {
auto found_event = found_eventgroup->second.find(_event);
if (found_event != found_eventgroup->second.end()) {
handlers.push_back(found_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(found_event->second.first);
}
} else {
auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
if (its_any_event != found_eventgroup->second.end()) {
handlers.push_back(its_any_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(its_any_event->second.first);
}
}
}
}
Expand All @@ -947,11 +959,15 @@ void application_impl::deliver_subscription_state(service_t _service, instance_t
if (found_eventgroup != found_instance->second.end()) {
auto found_event = found_eventgroup->second.find(_event);
if (found_event != found_eventgroup->second.end()) {
handlers.push_back(found_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(found_event->second.first);
}
} else {
auto its_any_event = found_eventgroup->second.find(ANY_EVENT);
if (its_any_event != found_eventgroup->second.end()) {
handlers.push_back(its_any_event->second);
if (!_error || (_error && found_event->second.second)) {
handlers.push_back(its_any_event->second.first);
}
}
}
}
Expand Down Expand Up @@ -1017,9 +1033,17 @@ void application_impl::on_subscription_error(service_t _service,
void application_impl::register_subscription_status_handler(service_t _service,
instance_t _instance, eventgroup_t _eventgroup, event_t _event,
subscription_status_handler_t _handler) {
register_subscription_status_handler(_service, _instance, _eventgroup,
_event, _handler, false);
}

void application_impl::register_subscription_status_handler(service_t _service,
instance_t _instance, eventgroup_t _eventgroup, event_t _event,
subscription_status_handler_t _handler, bool _is_selective) {
std::lock_guard<std::mutex> its_lock(subscription_status_handlers_mutex_);
if (_handler) {
subscription_status_handlers_[_service][_instance][_eventgroup][_event] = _handler;
subscription_status_handlers_[_service][_instance][_eventgroup][_event] =
std::make_pair(_handler, _is_selective);
} else {
auto its_service = subscription_status_handlers_.find(_service);
if (its_service != subscription_status_handlers_.end()) {
Expand Down
23 changes: 23 additions & 0 deletions interface/vsomeip/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,29 @@ class application {
virtual void register_subscription_status_handler(service_t _service,
instance_t _instance, eventgroup_t _eventgroup, event_t _event,
subscription_status_handler_t _handler) = 0;

/**
*
* \brief Registers a subscription status listener.
*
* When registered such a handler it will be called for
* every application::subscribe call.
*
* This method is intended to replace the application::
* register_subscription_error_handler call in future releases.
*
* \param _service Service identifier of the service that is subscribed to.
* \param _instance Instance identifier of the service that is subscribed to.
* \param _eventgroup Eventgroup identifier of the eventgroup is subscribed to.
* \param _event Event indentifier of the event is subscribed to.
* \param _handler A subscription status handler which will be called by vSomeIP
* as a follow of application::subscribe.
* \param _is_selective Flag to enable calling the provided handler if the
* subscription is answered with a SUBSCRIBE_NACK.
*/
virtual void register_subscription_status_handler(service_t _service,
instance_t _instance, eventgroup_t _eventgroup, event_t _event,
subscription_status_handler_t _handler, bool _is_selective) = 0;
};

/** @} */
Expand Down

0 comments on commit ba05080

Please sign in to comment.