2019-07-28 10:31:56 +08:00
|
|
|
|
#include "lib_acl.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "http_plugin.h"
|
|
|
|
|
|
|
|
|
|
static ACL_DLL_ENV __dll_env;
|
|
|
|
|
static acl_pthread_pool_t *__thrpool = NULL;
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20><>ʼ<EFBFBD><CABC><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
static void plugin_init(ACL_DLL_ENV *dll_env)
|
|
|
|
|
{
|
|
|
|
|
if (dll_env)
|
|
|
|
|
memcpy(&__dll_env, dll_env, sizeof(ACL_DLL_ENV));
|
|
|
|
|
else
|
|
|
|
|
memset(&__dll_env, 0, sizeof(ACL_DLL_ENV));
|
|
|
|
|
if (__dll_env.logfp) {
|
|
|
|
|
acl_msg_open2(__dll_env.logfp, "http-gb");
|
|
|
|
|
acl_msg_info("%s(%d): logger opened, %s", __FUNCTION__,
|
|
|
|
|
__LINE__, ACL_VSTREAM_PATH(__dll_env.logfp));
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD> mem_slice <20>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>䷽ʽ */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
if (__dll_env.mem_slice)
|
|
|
|
|
acl_mem_slice_set(__dll_env.mem_slice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void http_plugin_init(ACL_DLL_ENV *dll_env, const char *cfg_dir)
|
|
|
|
|
{
|
|
|
|
|
plugin_init(dll_env);
|
|
|
|
|
http_conf_load(cfg_dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void http_plugin_pool_create(int threads_limit, int threads_idle)
|
|
|
|
|
{
|
|
|
|
|
const char *myname = "http_plugin_pool_create";
|
|
|
|
|
|
|
|
|
|
if (__thrpool != NULL) {
|
|
|
|
|
acl_msg_error("%s(%d): thread pool has been created!",
|
|
|
|
|
myname, __LINE__);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>̳߳<DFB3> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
__thrpool = acl_thread_pool_create(threads_limit, threads_idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void http_plugin_pool_append(void (*start_routine)(void *), void *arg)
|
|
|
|
|
{
|
|
|
|
|
acl_pthread_pool_add(__thrpool, start_routine, arg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void http_plugin_debug_memory(int level)
|
|
|
|
|
{
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
switch (level) {
|
|
|
|
|
case 1:
|
|
|
|
|
acl_memory_debug_start();
|
|
|
|
|
acl_memory_debug_stack(1);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
__dll_env.mmd = acl_debug_malloc_init(__dll_env.mmd,
|
|
|
|
|
"access_log.txt");
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
__dll_env.mmd = acl_debug_malloc_init(__dll_env.mmd,
|
|
|
|
|
"access_log.txt");
|
|
|
|
|
acl_memory_debug_start();
|
|
|
|
|
acl_memory_debug_stack(1);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|