Skip to content

Commit a03310f

Browse files
committed
Fix event config loading defaulting to RT_UNRELIABLE
Summary: When events are first parsed, the config loader reads eventgroups first. Because the event doesn't have an existing configuration, it creates one with RT_UNRELIABLE by default. But when the actual event is parsed, it detects the dummy event and displays a VSOMEIP_INFO message; and the event reliability type is not being correctly updated to RT_RELIABLE. This fix changes the default reliability type to RT_UNKNOWN when events are created from 'eventgroup' parsing. And then updates the event correctly when the actual event entry is parsed.
1 parent d584217 commit a03310f

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

implementation/configuration/src/configuration_impl.cpp

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,28 +2203,38 @@ void configuration_impl::load_event(
22032203
}
22042204

22052205
if (its_event_id > 0) {
2206-
auto found_event = _service->events_.find(its_event_id);
2207-
if (found_event != _service->events_.end()) {
2208-
VSOMEIP_INFO << "Multiple configurations for event ["
2209-
<< std::hex << _service->service_ << "."
2210-
<< _service->instance_ << "."
2211-
<< its_event_id << "].";
2212-
} else {
2213-
// If event reliability type was not configured,
2214-
if (its_reliability == reliability_type_e::RT_UNKNOWN) {
2215-
if (_service->unreliable_ != ILLEGAL_PORT) {
2216-
its_reliability = reliability_type_e::RT_UNRELIABLE;
2217-
} else if (_service->reliable_ != ILLEGAL_PORT) {
2218-
its_reliability = reliability_type_e::RT_RELIABLE;
2219-
}
2206+
// If event reliability type was not configured,
2207+
if (its_reliability == reliability_type_e::RT_UNKNOWN) {
2208+
if (_service->unreliable_ != ILLEGAL_PORT) {
2209+
its_reliability = reliability_type_e::RT_UNRELIABLE;
2210+
} else if (_service->reliable_ != ILLEGAL_PORT) {
2211+
its_reliability = reliability_type_e::RT_RELIABLE;
2212+
} else {
22202213
VSOMEIP_WARNING << "Reliability type for event ["
22212214
<< std::hex << _service->service_ << "."
22222215
<< _service->instance_ << "."
22232216
<< its_event_id << "] was not configured Using : "
22242217
<< ((its_reliability == reliability_type_e::RT_RELIABLE)
22252218
? "RT_RELIABLE" : "RT_UNRELIABLE");
22262219
}
2220+
}
22272221

2222+
auto found_event = _service->events_.find(its_event_id);
2223+
if (found_event != _service->events_.end()) {
2224+
if (found_event->second->reliability_ == reliability_type_e::RT_UNKNOWN) {
2225+
auto its_event = found_event->second;
2226+
its_event->reliability_ = its_reliability;
2227+
its_event->is_field_ = its_is_field;
2228+
its_event->cycle_ = its_cycle;
2229+
its_event->update_on_change_ = its_update_on_change;
2230+
its_event->change_resets_cycle_ = its_change_resets_cycle;
2231+
} else {
2232+
VSOMEIP_WARNING << "Multiple configurations for event ["
2233+
<< std::hex << _service->service_ << "."
2234+
<< _service->instance_ << "."
2235+
<< its_event_id << "].";
2236+
}
2237+
} else {
22282238
auto its_event = std::make_shared<event>(
22292239
its_event_id, its_is_field, its_reliability,
22302240
its_cycle, its_change_resets_cycle,
@@ -2294,7 +2304,7 @@ void configuration_impl::load_eventgroup(
22942304
its_event = find_event->second;
22952305
} else {
22962306
its_event = std::make_shared<event>(its_event_id,
2297-
false, reliability_type_e::RT_UNRELIABLE,
2307+
false, reliability_type_e::RT_UNKNOWN,
22982308
std::chrono::milliseconds::zero(),
22992309
false, true);
23002310
}

0 commit comments

Comments
 (0)