| 304 | } |
| 305 | |
| 306 | TSReturnCode |
| 307 | TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size) |
| 308 | { |
| 309 | if (!api_info || api_info->size < sizeof(TSRemapInterface)) { |
| 310 | strncpy(errbuf, "[TSRemapInit] - Incorrect size of TSRemapInterface structure", errbuf_size - 1); |
| 311 | errbuf[errbuf_size - 1] = '\0'; |
| 312 | return TS_ERROR; |
| 313 | } |
| 314 | |
| 315 | if (nullptr == ts_lua_main_ctx_array) { |
| 316 | ts_lua_main_ctx_array = create_lua_vms(); |
| 317 | if (nullptr != ts_lua_main_ctx_array) { |
| 318 | pthread_key_create(&lua_state_key, nullptr); |
| 319 | |
| 320 | TSCont const lcontp = TSContCreate(lifecycleHandler, TSMutexCreate()); |
| 321 | TSContDataSet(lcontp, ts_lua_main_ctx_array); |
| 322 | TSLifecycleHookAdd(TS_LIFECYCLE_MSG_HOOK, lcontp); |
| 323 | |
| 324 | ts_lua_plugin_stats *const plugin_stats = create_plugin_stats(ts_lua_main_ctx_array, ts_lua_stat_strs); |
| 325 | |
| 326 | // start the stats management |
| 327 | if (nullptr != plugin_stats) { |
| 328 | Dbg(dbg_ctl, "Starting up stats management continuation"); |
| 329 | TSCont const scontp = TSContCreate(statsHandler, TSMutexCreate()); |
| 330 | TSContDataSet(scontp, plugin_stats); |
| 331 | TSContScheduleOnPool(scontp, TS_LUA_STATS_TIMEOUT, TS_THREAD_POOL_TASK); |
| 332 | } |
| 333 | } else { |
| 334 | return TS_ERROR; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | return TS_SUCCESS; |
| 339 | } |
| 340 | |
| 341 | TSReturnCode |
| 342 | TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_size) |
nothing calls this directly
no test coverage detected