From 62f9a4c9826d9c1463d1718583824fda84239e1b Mon Sep 17 00:00:00 2001 From: "Bostin.wang" Date: Mon, 5 Aug 2019 13:37:23 +0800 Subject: [PATCH] replace sky_close with application_instance --- skywalking.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/skywalking.c b/skywalking.c index 420bb5a..78d9ef0 100644 --- a/skywalking.c +++ b/skywalking.c @@ -69,7 +69,6 @@ ZEND_DECLARE_MODULE_GLOBALS(skywalking) static int le_skywalking; static int application_instance = 0; static int application_id = 0; -static int sky_close = 0; static int sky_increment_id = 0; static int cli_debug = 0; @@ -324,7 +323,7 @@ ZEND_API void sky_execute_ex(zend_execute_data *execute_data) { ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return_value) { - if (sky_close == 1) { + if (application_instance == 0) { if (ori_execute_internal) { ori_execute_internal(execute_data, return_value); } else { @@ -593,7 +592,7 @@ ZEND_API void sky_execute_internal(zend_execute_data *execute_data, zval *return void sky_curl_exec_handler(INTERNAL_FUNCTION_PARAMETERS) { - if(sky_close == 1) { + if(application_instance == 0) { orig_curl_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -832,7 +831,7 @@ void sky_curl_exec_handler(INTERNAL_FUNCTION_PARAMETERS) } void sky_curl_setopt_handler(INTERNAL_FUNCTION_PARAMETERS) { - if(sky_close == 1) { + if(application_instance == 0) { orig_curl_setopt(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -862,7 +861,7 @@ void sky_curl_setopt_handler(INTERNAL_FUNCTION_PARAMETERS) { void sky_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAMETERS) { - if(sky_close == 1) { + if(application_instance == 0) { orig_curl_setopt_array(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -889,7 +888,7 @@ void sky_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAMETERS) { void sky_curl_close_handler(INTERNAL_FUNCTION_PARAMETERS) { - if(sky_close == 1) { + if(application_instance == 0) { orig_curl_close(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; } @@ -1579,10 +1578,7 @@ PHP_RINIT_FUNCTION(skywalking) } sky_register(); if (application_instance == 0) { - sky_close = 1; return SUCCESS; - } else { - sky_close = 0; } sky_increment_id++; if (sky_increment_id >= 9999) { @@ -1604,7 +1600,7 @@ PHP_RSHUTDOWN_FUNCTION(skywalking) if (strcasecmp("cli", sapi_module.name) == 0 && cli_debug == 0) { return SUCCESS; } - if (sky_close == 1) { + if (application_instance == 0) { return SUCCESS; } sky_flush_all(); -- GitLab