MXS-1929: Initialize filter in filter_alloc

Changed the filter_alloc function to fully initialize the filter. This
means that if filter_alloc returns a non-NULL pointer, the filter was
successfully loaded and an instance was successfully created.
This commit is contained in:
Markus Mäkelä
2018-07-24 08:39:57 +03:00
parent 382595a2b8
commit cea36dc7be
4 changed files with 32 additions and 65 deletions

View File

@ -1252,23 +1252,15 @@ bool service_set_filters(SERVICE* service, const char* filters)
if (MXS_FILTER_DEF* def = filter_def_find(f.c_str()))
{
if (filter_load(def))
{
flist.push_back(def);
flist.push_back(def);
const MXS_MODULE* module = get_module(def->module, MODULE_FILTER);
ss_dassert(module);
capabilities |= module->module_capabilities;
const MXS_MODULE* module = get_module(def->module, MODULE_FILTER);
ss_dassert(module);
capabilities |= module->module_capabilities;
if (def->obj->getCapabilities)
{
capabilities |= def->obj->getCapabilities(def->filter);
}
}
else
if (def->obj->getCapabilities)
{
MXS_ERROR("Failed to load filter '%s' for service '%s'.", f.c_str(), service->name);
rval = false;
capabilities |= def->obj->getCapabilities(def->filter);
}
}
else