Sun, 23 Jun 2013 13:51:49 +0200
merge
src/server/daemon/config.c | file | annotate | diff | comparison | revisions |
--- a/src/server/daemon/config.c Sat Jun 22 13:54:41 2013 +0200 +++ b/src/server/daemon/config.c Sun Jun 23 13:51:49 2013 +0200 @@ -677,14 +677,14 @@ return NULL; } - /* create object config */ + // create object config pool_handle_t *pool = pool_create(); HTTPObjectConfig *conf = pool_calloc(pool, sizeof(HTTPObjectConfig), 1); conf->pool = pool; - /* convert ObjectConfig to HTTPObjectConfig */ + // convert ObjectConfig to HTTPObjectConfig - /* add objects */ + // add objects conf->nobj = ucx_dlist_size(cfg->objects); conf->objects = pool_calloc(pool, 1, sizeof(httpd_object*)); @@ -693,7 +693,7 @@ while(objlist != NULL) { ConfigObject *cob = objlist->data; - /* get name and ppath */ + // get name and ppath char *name = NULL; char *ppath = NULL; if(cob->name.length > 0) { @@ -703,13 +703,13 @@ ppath = sstrdup_pool(pool, cob->ppath).ptr; } - /* create and add object */ + // create and add object httpd_object *obj = object_new(pool, name); obj->path = NULL; conf->objects[i] = obj; // TODO: beyond array bounds write - /* add directives */ + // add directives for(int i=0;i<6;i++) { UcxDlist *dirs = cob->directives[i]; while(dirs != NULL) { @@ -719,7 +719,7 @@ d->cond = NULL; d->param = pblock_create_pool(pool, 8); - /* add params */ + // add params UcxList *param = cfg_param_list(cfgdir->value, mp); while(param != NULL) { ConfigParam *p = param->data; @@ -732,18 +732,18 @@ param = param->next; } - /* get function */ + // get function char *func_name = pblock_findval("fn", d->param); d->func = get_function(func_name); dirs = dirs->next; - /* add function to dtable */ + // add function to dtable object_add_directive(obj, d, cfgdir->type_num); } } - /* next */ + // next i++; objlist = objlist->next; }
--- a/src/server/daemon/configmanager.c Sat Jun 22 13:54:41 2013 +0200 +++ b/src/server/daemon/configmanager.c Sun Jun 23 13:51:49 2013 +0200 @@ -140,8 +140,7 @@ } ServerConfiguration *config; - //if(sc_last_modified != s.st_mtim.tv_sec) { - if(cfgreload || !current_config) { + if(cfgreload || !current_config || sc_last_modified != s.st_mtime) { printf("cfgmgr load server.conf\n"); config = load_server_conf( current_config,
--- a/src/server/daemon/httplistener.c Sat Jun 22 13:54:41 2013 +0200 +++ b/src/server/daemon/httplistener.c Sun Jun 23 13:51:49 2013 +0200 @@ -89,6 +89,7 @@ newls->default_vs.vs_name = conf->vs.ptr; newls->port = fl->port; newls->server_socket = fl->server_socket; + newls->running = 1; newls->ref = 2; // 1 reference is fl->next newls->session_handler = fl->session_handler; // TODO @@ -139,6 +140,7 @@ // end remove HttpListener *listener = malloc(sizeof(HttpListener)); + listener->running = 0; listener->cfg = conf->cfg; listener->name = conf->name; listener->default_vs.vs_name = conf->vs.ptr; @@ -194,6 +196,9 @@ } int http_listener_start(HttpListener *listener) { + if(listener->running) { + return 0; + } printf("INFO: start listener\n"); log_ereport(LOG_INFORM, "start listener on port %d", listener->port);
--- a/src/server/daemon/httplistener.h Sat Jun 22 13:54:41 2013 +0200 +++ b/src/server/daemon/httplistener.h Sun Jun 23 13:51:49 2013 +0200 @@ -72,6 +72,7 @@ HttpListener *next; Acceptor **acceptors; int nacceptors; + int running; uint32_t ref; // reference counter };
--- a/src/server/daemon/main.c Sat Jun 22 13:54:41 2013 +0200 +++ b/src/server/daemon/main.c Sun Jun 23 13:51:49 2013 +0200 @@ -42,6 +42,7 @@ #include "webserver.h" #include "log.h" #include "httprequest.h" +#include "httplistener.h" #include "configmanager.h" @@ -63,6 +64,8 @@ if(cfgmgr_load_config() != 0) { log_ereport(LOG_FAILURE, "cannot reload config"); } + // start newly created listeners + start_all_listener(); signal(SIGUSR1, sig_usr1_reload); }