{
struct hlua_function *fcn = (struct hlua_function *)private;
+ /* In the execution wrappers linked with a session, the
+ * Lua context can be not initialized. This behavior
+ * permits to save performances because a systematic
+ * Lua initialization cause 5% performances loss.
+ */
+ if (!session->hlua.T && !hlua_ctx_init(&session->hlua, session->task)) {
+ send_log(session->be, LOG_ERR, "Lua converter '%s': can't initialize Lua context.", fcn->name);
+ if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
+ Alert("Lua converter '%s': can't initialize Lua context.\n", fcn->name);
+ return 0;
+ }
+
/* If it is the first run, initialize the data for the call. */
if (session->hlua.state == HLUA_STOP) {
/* Check stack available size. */
{
struct hlua_function *fcn = (struct hlua_function *)private;
+ /* In the execution wrappers linked with a session, the
+ * Lua context can be not initialized. This behavior
+ * permits to save performances because a systematic
+ * Lua initialization cause 5% performances loss.
+ */
+ if (!s->hlua.T && !hlua_ctx_init(&s->hlua, s->task)) {
+ send_log(s->be, LOG_ERR, "Lua sample-fetch '%s': can't initialize Lua context.", fcn->name);
+ if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
+ Alert("Lua sample-fetch '%s': can't initialize Lua context.\n", fcn->name);
+ return 0;
+ }
+
/* If it is the first run, initialize the data for the call. */
if (s->hlua.state == HLUA_STOP) {
/* Check stack available size. */
{
char **arg;
+ /* In the execution wrappers linked with a session, the
+ * Lua context can be not initialized. This behavior
+ * permits to save performances because a systematic
+ * Lua initialization cause 5% performances loss.
+ */
+ if (!s->hlua.T && !hlua_ctx_init(&s->hlua, s->task)) {
+ send_log(px, LOG_ERR, "Lua action '%s': can't initialize Lua context.", rule->fcn.name);
+ if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))
+ Alert("Lua action '%s': can't initialize Lua context.\n", rule->fcn.name);
+ return 0;
+ }
+
/* If it is the first run, initialize the data for the call. */
if (s->hlua.state == HLUA_STOP) {
/* Check stack available size. */
txn->rsp.chn = s->rep;
#ifdef USE_LUA
- if (!hlua_ctx_init(&s->hlua, s->task))
- goto out_free_rep;
+ s->hlua.T = NULL;
#endif
/* finish initialization of the accepted file descriptor */
* finished (=0, eg: monitoring), in both situations,
* we can release everything and close.
*/
- goto out_free_lua;
+ goto out_free_rep;
}
/* if logs require transport layer information, note it on the connection */
return 1;
/* Error unrolling */
- out_free_lua:
-#ifdef USE_LUA
- hlua_ctx_destroy(&s->hlua);
-#endif
-
out_free_rep:
pool_free2(pool2_channel, s->rep);
out_free_req:
session_offer_buffers();
#ifdef USE_LUA
- hlua_ctx_destroy(&s->hlua);
+ if (s->hlua.T)
+ hlua_ctx_destroy(&s->hlua);
#endif
pool_free2(pool2_channel, s->req);