57 #include "../util/pblock.h" |
57 #include "../util/pblock.h" |
58 #include "../util/util.h" |
58 #include "../util/util.h" |
59 #include "../util/atomic.h" |
59 #include "../util/atomic.h" |
60 #include "cx/buffer.h" |
60 #include "cx/buffer.h" |
61 |
61 |
62 pool_handle_t *init_pool; |
62 static pool_handle_t *init_pool; |
|
63 |
|
64 pool_handle_t* cfg_get_init_pool(void) { |
|
65 return init_pool; |
|
66 } |
63 |
67 |
64 char* cfg_config_file_path(const char *file) { |
68 char* cfg_config_file_path(const char *file) { |
65 cxstring base = CX_STR("config/"); |
69 cxstring base = CX_STR("config/"); |
66 cxmutstr path = cx_strcat(2, base, cx_str(file)); |
70 cxmutstr path = cx_strcat(2, base, cx_str(file)); |
67 return path.ptr; |
71 return path.ptr; |
692 lc.ssl = WS_FALSE; |
696 lc.ssl = WS_FALSE; |
693 } |
697 } |
694 |
698 |
695 // TODO: check if all important configs are set |
699 // TODO: check if all important configs are set |
696 |
700 |
|
701 int ret = 0; |
697 HttpListener *listener = http_listener_create(&lc); |
702 HttpListener *listener = http_listener_create(&lc); |
698 if(!listener) { |
703 if(listener) { |
699 return 1; |
704 listener->default_vs.vs_name = cx_strdup_a(cfg->a, (cxstring){lc.vs.ptr, lc.vs.length}).ptr; |
700 } |
705 cxListAdd(cfg->listeners, listener); |
701 |
706 } else { |
702 listener->default_vs.vs_name = cx_strdup_a(cfg->a, (cxstring){lc.vs.ptr, lc.vs.length}).ptr; |
707 ret = 1; |
703 cxListAdd(cfg->listeners, listener); |
708 } |
|
709 |
|
710 free(lc.name.ptr); |
|
711 free(lc.vs.ptr); |
|
712 free(lc.threadpool.ptr); |
704 |
713 |
705 return 0; |
714 return 0; |
706 } |
715 } |
707 |
716 |
708 int cfg_handle_vs(ServerConfiguration *cfg, ConfigNode *obj) { |
717 int cfg_handle_vs(ServerConfiguration *cfg, ConfigNode *obj) { |