utils: error injection: check if it is an ongoing one-shot injection in is_enabled
Change it for consistency with `enabled_injections`. Closes #14597
This commit is contained in:
committed by
Kamil Braun
parent
4cee8206f8
commit
b165f1e88b
@@ -224,7 +224,8 @@ private:
|
||||
std::map<sstring, injection_data, str_less> _enabled;
|
||||
|
||||
bool is_enabled(const std::string_view& injection_name) const {
|
||||
return _enabled.contains(injection_name);
|
||||
auto data = get_data(injection_name);
|
||||
return data && !data->is_ongoing_oneshot();
|
||||
}
|
||||
|
||||
bool is_one_shot(const std::string_view& injection_name) const {
|
||||
@@ -235,6 +236,14 @@ private:
|
||||
return it->second.one_shot;
|
||||
}
|
||||
|
||||
injection_data const* get_data(const std::string_view& injection_name) const {
|
||||
const auto it = _enabled.find(injection_name);
|
||||
if (it == _enabled.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
injection_data* get_data(const std::string_view& injection_name) {
|
||||
const auto it = _enabled.find(injection_name);
|
||||
if (it == _enabled.end()) {
|
||||
|
||||
Reference in New Issue
Block a user