TODO: remove extern variable

This commit is contained in:
Xuan Sang LE 2018-09-26 11:07:48 +02:00
parent 90d44d782f
commit d50b1352f6
3 changed files with 15 additions and 4 deletions

View File

@ -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);

View File

@ -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

View File

@ -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