You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/07/31 21:15:48 UTC
[trafficserver] 03/03: Add flag to enable the reload feature.
Disable by default
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 85189b229ad04be27857f0105b2b346b3e40e080
Author: Kit Chan <ki...@apache.org>
AuthorDate: Wed Jul 11 00:07:20 2018 -0700
Add flag to enable the reload feature. Disable by default
(cherry picked from commit 3192bce394b95de37f231a8c472c78cf8313e57a)
---
plugins/lua/ts_lua.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/plugins/lua/ts_lua.c b/plugins/lua/ts_lua.c
index ea73143..0d8af2c 100644
--- a/plugins/lua/ts_lua.c
+++ b/plugins/lua/ts_lua.c
@@ -457,8 +457,10 @@ TSPluginInit(int argc, const char *argv[])
}
int states = TS_LUA_MAX_STATE_COUNT;
+ int reload = 0;
static const struct option longopt[] = {
{"states", required_argument, 0, 's'},
+ {"enable-reload", no_argument, 0, 'r'},
{0, 0, 0, 0},
};
@@ -471,6 +473,10 @@ TSPluginInit(int argc, const char *argv[])
states = atoi(optarg);
// set state
break;
+ case 'r':
+ reload = 1;
+ TSDebug(TS_LUA_DEBUG_TAG, "[%s] enable global plugin reload [%d]", __FUNCTION__, reload);
+ break;
}
if (opt == -1) {
@@ -607,12 +613,15 @@ TSPluginInit(int argc, const char *argv[])
ts_lua_destroy_http_ctx(http_ctx);
- TSCont config_contp = TSContCreate(configHandler, NULL);
- if (!config_contp) {
- TSError("[ts_lua][%s] could not create configuration continuation", __FUNCTION__);
- return;
- }
- TSContDataSet(config_contp, conf);
+ // support for reload as global plugin
+ if (reload) {
+ TSCont config_contp = TSContCreate(configHandler, NULL);
+ if (!config_contp) {
+ TSError("[ts_lua][%s] could not create configuration continuation", __FUNCTION__);
+ return;
+ }
+ TSContDataSet(config_contp, conf);
- TSMgmtUpdateRegister(config_contp, "ts_lua");
+ TSMgmtUpdateRegister(config_contp, "ts_lua");
+ }
}