MINOR: applet: Change return value for .init callback function
0 is now returned on success and -1 on error.
diff --git a/src/hlua.c b/src/hlua.c
index 193956a..e323b9a 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -9226,7 +9226,7 @@
if (!hlua) {
SEND_ERR(strm->be, "Lua applet tcp '%s': out of memory.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
HLUA_INIT(hlua);
tcp_ctx->hlua = hlua;
@@ -9237,7 +9237,7 @@
if (!task) {
SEND_ERR(strm->be, "Lua applet tcp '%s': out of memory.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
task->nice = 0;
task->context = ctx;
@@ -9252,7 +9252,7 @@
if (!hlua_ctx_init(hlua, fcn_ref_to_stack_id(ctx->rule->arg.hlua_rule->fcn), task, 0)) {
SEND_ERR(strm->be, "Lua applet tcp '%s': can't initialize Lua context.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
/* Set timeout according with the applet configuration. */
@@ -9266,7 +9266,7 @@
error = "critical error";
SEND_ERR(strm->be, "Lua applet tcp '%s': %s.\n",
ctx->rule->arg.hlua_rule->fcn->name, error);
- return 0;
+ return -1;
}
/* Check stack available size. */
@@ -9274,7 +9274,7 @@
SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
/* Restore the function in the stack. */
@@ -9285,7 +9285,7 @@
SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
hlua->nargs = 1;
@@ -9295,7 +9295,7 @@
SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
lua_pushstring(hlua->T, *arg);
hlua->nargs++;
@@ -9307,7 +9307,7 @@
cs_cant_get(cs);
cs_rx_endp_more(cs);
- return 1;
+ return 0;
}
void hlua_applet_tcp_fct(struct appctx *ctx)
@@ -9400,9 +9400,8 @@
tcp_ctx->hlua = NULL;
}
-/* The function returns 1 if the initialisation is complete, 0 if
- * an errors occurs and -1 if more data are required for initializing
- * the applet. It also reserves the appctx for an hlua_http_ctx.
+/* The function returns 0 if the initialisation is complete or -1 if
+ * an errors occurs. It also reserves the appctx for an hlua_http_ctx.
*/
static int hlua_applet_http_init(struct appctx *ctx)
{
@@ -9420,7 +9419,7 @@
if (!hlua) {
SEND_ERR(strm->be, "Lua applet http '%s': out of memory.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
HLUA_INIT(hlua);
http_ctx->hlua = hlua;
@@ -9435,7 +9434,7 @@
if (!task) {
SEND_ERR(strm->be, "Lua applet http '%s': out of memory.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
task->nice = 0;
task->context = ctx;
@@ -9450,7 +9449,7 @@
if (!hlua_ctx_init(hlua, fcn_ref_to_stack_id(ctx->rule->arg.hlua_rule->fcn), task, 0)) {
SEND_ERR(strm->be, "Lua applet http '%s': can't initialize Lua context.\n",
ctx->rule->arg.hlua_rule->fcn->name);
- return 0;
+ return -1;
}
/* Set timeout according with the applet configuration. */
@@ -9464,7 +9463,7 @@
error = "critical error";
SEND_ERR(strm->be, "Lua applet http '%s': %s.\n",
ctx->rule->arg.hlua_rule->fcn->name, error);
- return 0;
+ return -1;
}
/* Check stack available size. */
@@ -9472,7 +9471,7 @@
SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
/* Restore the function in the stack. */
@@ -9483,7 +9482,7 @@
SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
hlua->nargs = 1;
@@ -9493,7 +9492,7 @@
SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n",
ctx->rule->arg.hlua_rule->fcn->name);
RESET_SAFE_LJMP(hlua);
- return 0;
+ return -1;
}
lua_pushstring(hlua->T, *arg);
hlua->nargs++;
@@ -9504,7 +9503,7 @@
/* Wakeup the applet when data is ready for read. */
cs_cant_get(cs);
- return 1;
+ return 0;
}
void hlua_applet_http_fct(struct appctx *ctx)