From d50b1352f656f11c5bc2a8f1d8f310666f80e82d Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 26 Sep 2018 11:07:48 +0200 Subject: [PATCH] TODO: remove extern variable --- libs/handle.c | 1 + libs/plugin.c | 3 +-- libs/plugin.h | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libs/handle.c b/libs/handle.c index e4becdd..670a0ab 100644 --- a/libs/handle.c +++ b/libs/handle.c @@ -134,6 +134,7 @@ int antd_close(void* src) //printf("Close sock %d\n", source->sock); int ret = close(source->sock); if(source->ip) free(source->ip); + // TODO remove this when using nonblocking server_config.connection--; LOG("Remaining connection %d\n", server_config.connection); free(src); diff --git a/libs/plugin.c b/libs/plugin.c index 24b38dc..b804861 100644 --- a/libs/plugin.c +++ b/libs/plugin.c @@ -2,7 +2,6 @@ plugin_header __plugin__; // private function -call __init__; void __init_plugin__(const char* pl,config_t* conf){ __plugin__.name = strdup(pl); __plugin__.dbpath= strdup(conf->db_path); @@ -12,7 +11,7 @@ void __init_plugin__(const char* pl,config_t* conf){ #ifdef USE_OPENSSL __plugin__.usessl = conf->usessl; #endif - if(__init__ != NULL) __init__(); + init(); }; #ifdef USE_DB diff --git a/libs/plugin.h b/libs/plugin.h index a51dbf0..8f5ac48 100644 --- a/libs/plugin.h +++ b/libs/plugin.h @@ -19,12 +19,21 @@ typedef struct { -typedef void(*call)(); +//typedef void(*call)(); #ifdef USE_DB typedef sqlite3* sqldb; #endif +/* +Two server, +Two configuration different +Does it work +Replace this by a accessing function +that execute the set value to +the header, instead of +exporting global variables +*/ extern plugin_header __plugin__; -extern call __init__; +//extern call __init__; #ifdef USE_DB @@ -36,6 +45,8 @@ char* route(const char*); char* htdocs(const char*); char* config_dir(); /*Default function for plugin*/ +// init the plugin +void init(); void handle(void*, const char*,const char*,dictionary); void __release(); #endif