diff --git a/server/core/config.cc b/server/core/config.cc index 85a9bf66a..e23f24c70 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -3404,7 +3404,9 @@ int create_new_service(CONFIG_CONTEXT *obj) if (char* filters = config_get_value(obj->parameters, CN_FILTERS)) { - if (!service_set_filters(service, filters)) + auto flist = mxs::strtok(filters, "|"); + + if (!service->set_filters(flist)) { error_count++; } diff --git a/server/core/internal/service.hh b/server/core/internal/service.hh index 37580913a..4b3307fc4 100644 --- a/server/core/internal/service.hh +++ b/server/core/internal/service.hh @@ -71,7 +71,7 @@ public: * * @return True if filters were all found and were valid */ - bool set_filters(const std::string& filters); + bool set_filters(const std::vector& filters); /** * Get the list of filters this service uses @@ -311,9 +311,6 @@ void service_replace_parameter(Service *service, const char* key, const char* va // Internal search function Service* service_internal_find(const char *name); -// Assign filters to service -bool service_set_filters(Service *service, const char* filters); - /** * @brief Check if a service uses a server * @param service Service to check diff --git a/server/core/service.cc b/server/core/service.cc index 74dbea19d..f11e5089a 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -1060,13 +1060,13 @@ int service_enable_root(Service *svc, int action) return 1; } -bool Service::set_filters(const std::string& filters) +bool Service::set_filters(const std::vector& filters) { bool rval = true; std::vector flist; uint64_t my_capabilities = 0; - for (auto& f : mxs::strtok(filters, "|")) + for (auto f : filters) { fix_object_name(f); @@ -1137,20 +1137,6 @@ const Service::FilterList& Service::get_filters() const return *get_local_filters(); } -/** - * Set the filters used by the service - * - * @param service The service itself - * @param filters The filters to use separated by the pipe character | - * - * @return True if loading and creating all filters was successful. False if a - * filter module was not found or the instance creation failed. - */ -bool service_set_filters(Service* service, const char* filters) -{ - return service->set_filters(filters); -} - Service* service_internal_find(const char *name) { LockGuard guard(this_unit.lock); @@ -2454,10 +2440,6 @@ bool Service::update_basic_parameter(const std::string& key, const std::string& retry_start = config_truth_value(value.c_str()); valid = true; } - else if (key == CN_FILTERS) - { - valid = set_filters(value); - } return valid; }