mirror of
https://github.com/lxsang/ant-http
synced 2025-07-13 13:04:23 +02:00
Unload plugin if pannic happen
All checks were successful
gitea-sync/ant-http/pipeline/head This commit looks good
All checks were successful
gitea-sync/ant-http/pipeline/head This commit looks good
This commit is contained in:
@ -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 *);
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user