From 6dd479104f06570692d821b0e7dc61a43faa9646 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 14 Jun 2018 14:09:52 +0300 Subject: [PATCH] MXS-421 Enable the turning on of events --- include/maxscale/event.hh | 2 +- server/core/config.cc | 44 ++++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/include/maxscale/event.hh b/include/maxscale/event.hh index 253a2a9e6..80cc26506 100644 --- a/include/maxscale/event.hh +++ b/include/maxscale/event.hh @@ -92,7 +92,7 @@ const char* to_string(id_t id); * @return True, if the string could be converted, false otherwise. */ bool from_string(id_t* pId, const char* zValue); -bool from_string(id_t* pId, const std::string& value) +inline bool from_string(id_t* pId, const std::string& value) { return from_string(pId, value.c_str()); } diff --git a/server/core/config.cc b/server/core/config.cc index af27b6f21..00120d6b3 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -49,6 +49,7 @@ #include #include "internal/config.h" +#include "internal/event.hh" #include "internal/filter.h" #include "internal/modules.h" #include "internal/monitor.h" @@ -1967,26 +1968,45 @@ handle_global_item(const char *name, const char *value) } else { + bool found = false; #ifndef SS_DEBUG if (strcmp(name, "log_debug") == 0) { MXS_WARNING("The 'log_debug' option has no effect in release mode."); + found = true; } + else #endif - bool found = false; - for (i = 0; lognames[i].name; i++) { - if (strcasecmp(name, lognames[i].name) == 0) - { - found = true; - if (lognames[i].replacement) - { - MXS_WARNING("In the configuration file the use of '%s' is deprecated, " - "use '%s' instead.", - lognames[i].name, lognames[i].replacement); - } + maxscale::event::result_t result = maxscale::event::configure(name, value); - mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value)); + switch (result) + { + case maxscale::event::ACCEPTED: + found = true; + break; + + case maxscale::event::IGNORED: + for (i = 0; lognames[i].name; i++) + { + if (strcasecmp(name, lognames[i].name) == 0) + { + found = true; + if (lognames[i].replacement) + { + MXS_WARNING("In the configuration file the use of '%s' is deprecated, " + "use '%s' instead.", + lognames[i].name, lognames[i].replacement); + } + + mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value(value)); + } + } + break; + + case maxscale::event::INVALID: + // TODO: Should we bail out? + break; } }