From 795441073cc115838bef0817059b7c4e0878a3bf Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Thu, 24 Nov 2022 14:27:15 +0100 Subject: [PATCH] MINOR: hlua: properly handle hlua_process_task HLUA_E_ETMOUT In hlua_process_task: when HLUA_E_ETMOUT was returned by hlua_ctx_resume(), meaning that the lua task reached tune.lua.task-timeout (default: none), we logged "Lua task: unknown error." before stopping the task. Now we properly handle HLUA_E_ETMOUT to report a meaningful error message. --- src/hlua.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hlua.c b/src/hlua.c index 263d254..2ea15b9 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -8576,16 +8576,16 @@ struct task *hlua_process_task(struct task *task, void *context, unsigned int st break; /* finished with error. */ + case HLUA_E_ETMOUT: + SEND_ERR(NULL, "Lua task: execution timeout.\n"); + goto err_task_abort; case HLUA_E_ERRMSG: SEND_ERR(NULL, "Lua task: %s.\n", lua_tostring(hlua->T, -1)); - hlua_ctx_destroy(hlua); - task_destroy(task); - task = NULL; - break; - + goto err_task_abort; case HLUA_E_ERR: default: SEND_ERR(NULL, "Lua task: unknown error.\n"); + err_task_abort: hlua_ctx_destroy(hlua); task_destroy(task); task = NULL; -- 1.7.10.4