server/modules/filter/Makefile: Fixed problem which prevented cleaning and compiling hintfilter library.

server/core/config.c: Removed unused if..else block from config_get_valint. Changed it also to return value which indicates whether the operation succeed. Added config_get_valbool similar to config_get_valint.
service.c:Added typelib-like struct and array of valid boolean values. Fixed parameter type test in service_set_param_value. Completed boolean type parameter handling.
hintparser.c:Fixed error message for non-maxscale hints.
readwritesplit.c:Added loading of configuration parameters from service to instance and from instance to each new session. Fixed routing condition in get_route_target. Modified get_route_target so that it takes also rw_read_sesvars_from_slaves and rw_write_sesvars_to_all as parameters.
skygw_types.h: added array size counting macro.
This commit is contained in:
VilhoRaatikka
2014-09-08 21:44:23 +03:00
parent 92889ad216
commit f74493d922
9 changed files with 161 additions and 74 deletions

View File

@ -64,8 +64,8 @@ typedef struct typelib_st {
const char** tl_p_elems;
} typelib_t;
static const char* bool_strings[9]= {"FALSE", "TRUE", "OFF", "ON", "N", "Y", "0", "1", "NO", "YES", 0};
typelib_t bool_typelib = {array_nelems(bool_strings)-1, "bool_typelib", bool_strings};
static const char* bool_strings[11]= {"FALSE", "TRUE", "OFF", "ON", "N", "Y", "0", "1", "NO", "YES", 0};
typelib_t bool_type = {array_nelems(bool_strings)-1, "bool_type", bool_strings};
static SPINLOCK service_spin = SPINLOCK_INIT;
static SERVICE *allServices = NULL;
@ -1026,7 +1026,7 @@ bool service_set_param_value (
bool valbool;
bool succp = true;
if (type == PERCENT_TYPE || type == COUNT_TYPE)
if (PARAM_IS_TYPE(type,PERCENT_TYPE) ||PARAM_IS_TYPE(type,COUNT_TYPE))
{
/**
* Find out whether the value is numeric and ends with '%' or '\0'
@ -1090,7 +1090,7 @@ bool service_set_param_value (
{
unsigned int rc;
rc = find_type(&bool_typelib, valstr, strlen(valstr)+1);
rc = find_type(&bool_type, valstr, strlen(valstr)+1);
if (rc > 0)
{
@ -1103,6 +1103,10 @@ bool service_set_param_value (
{
valbool = true;
}
/** add param to config */
config_set_qualified_param(param,
(void *)&valbool,
BOOL_TYPE);
}
else
{
@ -1111,7 +1115,7 @@ bool service_set_param_value (
}
if (succp)
{
config_set_qualified_param(param, (void *)&valbool, BOOL_TYPE); /*< add param to config */
service_add_qualified_param(service, param); /*< add param to svc */
}
return succp;
}
@ -1152,8 +1156,6 @@ static int find_type(
}
return 0;
}
/**
* Add qualified config parameter to SERVICE struct.