Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module config update doesn't work as expected #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/flexisip/module.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ protected:
ModuleInfoBase *mInfo = nullptr;
GenericStruct *mModuleConfig = nullptr;
std::unique_ptr<EntryFilter> mFilter;
bool mDirtyConfig = false;

};

// -----------------------------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions src/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,22 @@ bool Module::isEnabled() const {
}

bool Module::doOnConfigStateChanged(const ConfigValue &conf, ConfigState state) {
bool dirtyConfig = false;
LOGD("Configuration of module %s changed for key %s to %s", mInfo->getModuleName().c_str(), conf.getName().c_str(),
conf.get().c_str());
switch (state) {
case ConfigState::Check:
return isValidNextConfig(conf);
case ConfigState::Changed:
dirtyConfig = true;
mDirtyConfig = true;
break;
case ConfigState::Reset:
dirtyConfig = false;
mDirtyConfig = false;
break;
case ConfigState::Commited:
if (dirtyConfig) {
if (mDirtyConfig) {
LOGI("Reloading config of module %s", mInfo->getModuleName().c_str());
reload();
dirtyConfig = false;
mDirtyConfig = false;
}
break;
}
Expand Down