| 254 | } |
| 255 | |
| 256 | void |
| 257 | ts_lua_script_register(lua_State *L, char *script, ts_lua_instance_conf *conf) |
| 258 | { |
| 259 | TSMgmtInt time; |
| 260 | |
| 261 | Dbg(dbg_ctl, "[%s] registering script [%s]", __FUNCTION__, script); |
| 262 | |
| 263 | // we recorded the script reconfigure_time and its conf pointer in registry |
| 264 | if (TS_SUCCESS == TSMgmtIntGet("proxy.process.proxy.reconfigure_time", &time)) { |
| 265 | lua_pushliteral(L, "__scriptTime"); |
| 266 | lua_pushstring(L, script); |
| 267 | lua_concat(L, 2); |
| 268 | lua_pushnumber(L, time); |
| 269 | lua_rawset(L, LUA_REGISTRYINDEX); |
| 270 | |
| 271 | lua_pushliteral(L, "__scriptPtr"); |
| 272 | lua_pushstring(L, script); |
| 273 | lua_concat(L, 2); |
| 274 | lua_pushlightuserdata(L, conf); |
| 275 | lua_rawset(L, LUA_REGISTRYINDEX); |
| 276 | } else { |
| 277 | TSError("[ts_lua][%s] failed to get node's reconfigure time while registering script", __FUNCTION__); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | int |
| 282 | ts_lua_add_module(ts_lua_instance_conf *conf, ts_lua_main_ctx *arr, int n, int argc, char *argv[], char *errbuf, int errbuf_size) |
no test coverage detected