src/server/daemon/config.c

branch
webdav
changeset 269
3dfbd0b91950
parent 260
4779a6fb4fbe
child 270
4cfaa02055cd
equal deleted inserted replaced
268:65ac1342ba1f 269:3dfbd0b91950
46 #include "log.h" 46 #include "log.h"
47 #include "event.h" 47 #include "event.h"
48 #include "threadpools.h" 48 #include "threadpools.h"
49 #include "ldap_auth.h" 49 #include "ldap_auth.h"
50 #include "configmanager.h" 50 #include "configmanager.h"
51 #include "resourcepool.h"
51 52
52 #include "vserver.h" 53 #include "vserver.h"
53 #include "../util/pblock.h" 54 #include "../util/pblock.h"
54 #include "../util/util.h" 55 #include "../util/util.h"
55 #include "../util/atomic.h" 56 #include "../util/atomic.h"
266 return NULL; 267 return NULL;
267 } 268 }
268 } 269 }
269 ucx_list_free(list); 270 ucx_list_free(list);
270 271
272 list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("ResourcePool"));
273 UCX_FOREACH(elm, list) {
274 ConfigNode *scfgobj = elm->data;
275 if(cfg_handle_resourcepool(serverconfig, scfgobj)) {
276 return NULL;
277 }
278 }
271 279
272 // set VirtualServer for all listeners 280 // set VirtualServer for all listeners
273 UcxList *ls = serverconfig->listeners; 281 UcxList *ls = serverconfig->listeners;
274 while(ls) { 282 while(ls) {
275 HttpListener *listener = ls->data; 283 HttpListener *listener = ls->data;
412 evcfg.nthreads = atoi(threads.ptr); 420 evcfg.nthreads = atoi(threads.ptr);
413 421
414 evcfg.isdefault = util_getboolean(isdefault.ptr, 0); 422 evcfg.isdefault = util_getboolean(isdefault.ptr, 0);
415 423
416 return create_event_handler(&evcfg); 424 return create_event_handler(&evcfg);
425 }
426
427 int cfg_handle_resourcepool(ServerConfiguration *cfg, ConfigNode *obj) {
428 scstr_t name = serverconfig_directive_value(obj, SC("Name"));
429 scstr_t type = serverconfig_directive_value(obj, SC("Type"));
430
431 int ret = 0;
432 if(resourcepool_new(cfg, name, type, obj)) {
433 ret = 1;
434 }
435
436 return ret;
417 } 437 }
418 438
419 int cfg_handle_accesslog(ServerConfiguration *cfg, ConfigNode *obj) { 439 int cfg_handle_accesslog(ServerConfiguration *cfg, ConfigNode *obj) {
420 // TODO: use a name to identify the log file 440 // TODO: use a name to identify the log file
421 441
888 908
889 free_keyfile_config(conf); 909 free_keyfile_config(conf);
890 910
891 return ret; 911 return ret;
892 } 912 }
913
914 pblock* config_obj2pblock(pool_handle_t *pool, ConfigNode *obj) {
915 pblock *pb = pblock_create_pool(pool, 8);
916 UCX_FOREACH(elm, obj->children) {
917 ConfigNode *d = elm->data;
918 if(d->type == CONFIG_NODE_DIRECTIVE && d->name.length > 0 && ucx_list_size(d->args) == 1) {
919 ConfigArg *arg = d->args->data;
920 pblock_nvlinsert(d->name.ptr, d->name.length, arg->value.ptr, arg->value.length, pb);
921 }
922 }
923 return pb;
924 }

mercurial