Unload plugin if pannic happen
All checks were successful
gitea-sync/ant-http/pipeline/head This commit looks good

This commit is contained in:
DanyLE
2023-01-11 22:18:45 +01:00
parent 6a483e188d
commit bd0663ddf7
4 changed files with 34 additions and 1 deletions

View File

@ -28,6 +28,9 @@
#define ANTD_CLIENT_RQ_DATA_DECODE 0x7
#define ANTD_CLIENT_PROXY_MONITOR 0x8
#define ANTD_PLUGIN_READY 0x0
#define ANTD_PLUGIN_PANNIC 0x1
typedef enum
{
ANTD_CGZ,
@ -111,6 +114,7 @@ typedef struct
char* pdir;
dictionary_t config;
int raw_body;
int status;
} plugin_header_t;
int __attribute__((weak)) require_plugin(const char *);

View File

@ -33,6 +33,11 @@ void use_raw_body();
STATIC PART, should be included in any plugin
*/
#ifdef PLUGIN_IMPLEMENT
#define PLUGIN_PANIC(a,...) \
ERROR("%s: "a,__plugin__.name, ##__VA_ARGS__); \
__plugin__.status = ANTD_PLUGIN_PANNIC;
static plugin_header_t __plugin__;
// private function
void __init_plugin__(const char* pl, dictionary_t* conf){
@ -42,6 +47,7 @@ void __init_plugin__(const char* pl, dictionary_t* conf){
tmpdir(&__plugin__.tmpdir);
__plugin__.config = conf;
__plugin__.raw_body = 0;
__plugin__.status = ANTD_PLUGIN_READY;
init();
};
void use_raw_body()