"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/hlua.c" between
haproxy-2.2.1.tar.gz and haproxy-2.2.2.tar.gz

About: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.

hlua.c  (haproxy-2.2.1):hlua.c  (haproxy-2.2.2)
skipping to change at line 1068 skipping to change at line 1068
* task wakeup. * task wakeup.
* - HLUA_E_ERRMSG : An error has occurred, an error message is set in * - HLUA_E_ERRMSG : An error has occurred, an error message is set in
* the top of the stack. * the top of the stack.
* - HLUA_E_ERR : An error has occurred without error message. * - HLUA_E_ERR : An error has occurred without error message.
* *
* If an error occurred, the stack is renewed and it is ready to run new * If an error occurred, the stack is renewed and it is ready to run new
* LUA code. * LUA code.
*/ */
static enum hlua_exec hlua_ctx_resume(struct hlua *lua, int yield_allowed) static enum hlua_exec hlua_ctx_resume(struct hlua *lua, int yield_allowed)
{ {
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 504
int nres;
#endif
int ret; int ret;
const char *msg; const char *msg;
const char *trace; const char *trace;
/* Initialise run time counter. */ /* Initialise run time counter. */
if (!HLUA_IS_RUNNING(lua)) if (!HLUA_IS_RUNNING(lua))
lua->run_time = 0; lua->run_time = 0;
/* Lock the whole Lua execution. This lock must be before the /* Lock the whole Lua execution. This lock must be before the
* label "resume_execution". * label "resume_execution".
skipping to change at line 1099 skipping to change at line 1102
HLUA_SET_RUN(lua); HLUA_SET_RUN(lua);
HLUA_CLR_CTRLYIELD(lua); HLUA_CLR_CTRLYIELD(lua);
HLUA_CLR_WAKERESWR(lua); HLUA_CLR_WAKERESWR(lua);
HLUA_CLR_WAKEREQWR(lua); HLUA_CLR_WAKEREQWR(lua);
/* Update the start time and reset wake_time. */ /* Update the start time and reset wake_time. */
lua->start_time = now_ms; lua->start_time = now_ms;
lua->wake_time = TICK_ETERNITY; lua->wake_time = TICK_ETERNITY;
/* Call the function. */ /* Call the function. */
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 504
ret = lua_resume(lua->T, gL.T, lua->nargs, &nres);
#else
ret = lua_resume(lua->T, gL.T, lua->nargs); ret = lua_resume(lua->T, gL.T, lua->nargs);
#endif
switch (ret) { switch (ret) {
case LUA_OK: case LUA_OK:
ret = HLUA_E_OK; ret = HLUA_E_OK;
break; break;
case LUA_YIELD: case LUA_YIELD:
/* Check if the execution timeout is expired. It it is the case, we /* Check if the execution timeout is expired. It it is the case, we
* break the Lua execution. * break the Lua execution.
*/ */
skipping to change at line 6633 skipping to change at line 6640
/* Execute the function. */ /* Execute the function. */
switch (hlua_ctx_resume(s->hlua, !(flags & ACT_OPT_FINAL))) { switch (hlua_ctx_resume(s->hlua, !(flags & ACT_OPT_FINAL))) {
/* finished. */ /* finished. */
case HLUA_E_OK: case HLUA_E_OK:
/* Catch the return value */ /* Catch the return value */
if (lua_gettop(s->hlua->T) > 0) if (lua_gettop(s->hlua->T) > 0)
act_ret = lua_tointeger(s->hlua->T, -1); act_ret = lua_tointeger(s->hlua->T, -1);
/* Set timeout in the required channel. */ /* Set timeout in the required channel. */
if (act_ret == ACT_RET_YIELD && s->hlua->wake_time != TICK_ETERNI if (act_ret == ACT_RET_YIELD) {
TY) { if (flags & ACT_OPT_FINAL)
if (dir == SMP_OPT_DIR_REQ) goto err_yield;
s->req.analyse_exp = s->hlua->wake_time;
else if (s->hlua->wake_time != TICK_ETERNITY) {
s->res.analyse_exp = s->hlua->wake_time; if (dir == SMP_OPT_DIR_REQ)
s->req.analyse_exp = s->hlua->wake_time;
else
s->res.analyse_exp = s->hlua->wake_time;
}
} }
goto end; goto end;
/* yield. */ /* yield. */
case HLUA_E_AGAIN: case HLUA_E_AGAIN:
/* Set timeout in the required channel. */ /* Set timeout in the required channel. */
if (s->hlua->wake_time != TICK_ETERNITY) { if (s->hlua->wake_time != TICK_ETERNITY) {
if (dir == SMP_OPT_DIR_REQ) if (dir == SMP_OPT_DIR_REQ)
s->req.analyse_exp = s->hlua->wake_time; s->req.analyse_exp = s->hlua->wake_time;
else else
skipping to change at line 6678 skipping to change at line 6690
case HLUA_E_ETMOUT: case HLUA_E_ETMOUT:
SEND_ERR(px, "Lua function '%s': execution timeout.\n", rule->arg .hlua_rule->fcn.name); SEND_ERR(px, "Lua function '%s': execution timeout.\n", rule->arg .hlua_rule->fcn.name);
goto end; goto end;
case HLUA_E_NOMEM: case HLUA_E_NOMEM:
SEND_ERR(px, "Lua function '%s': out of memory error.\n", rule->a rg.hlua_rule->fcn.name); SEND_ERR(px, "Lua function '%s': out of memory error.\n", rule->a rg.hlua_rule->fcn.name);
goto end; goto end;
case HLUA_E_YIELD: case HLUA_E_YIELD:
err_yield:
act_ret = ACT_RET_CONT;
SEND_ERR(px, "Lua function '%s': aborting Lua processing on expir ed timeout.\n", SEND_ERR(px, "Lua function '%s': aborting Lua processing on expir ed timeout.\n",
rule->arg.hlua_rule->fcn.name); rule->arg.hlua_rule->fcn.name);
goto end; goto end;
case HLUA_E_ERR: case HLUA_E_ERR:
/* Display log. */ /* Display log. */
SEND_ERR(px, "Lua function '%s' return an unknown error.\n", SEND_ERR(px, "Lua function '%s' return an unknown error.\n",
rule->arg.hlua_rule->fcn.name); rule->arg.hlua_rule->fcn.name);
default: default:
skipping to change at line 7835 skipping to change at line 7849
memprintf(err, "Lua runtime error: %s\n", lua_tostring(gL.T, -1)) ; memprintf(err, "Lua runtime error: %s\n", lua_tostring(gL.T, -1)) ;
lua_pop(gL.T, 1); lua_pop(gL.T, 1);
return -1; return -1;
case LUA_ERRMEM: case LUA_ERRMEM:
memprintf(err, "Lua out of memory error.n"); memprintf(err, "Lua out of memory error.n");
return -1; return -1;
case LUA_ERRERR: case LUA_ERRERR:
memprintf(err, "Lua message handler error: %s\n", lua_tostring(gL .T, -1)); memprintf(err, "Lua message handler error: %s\n", lua_tostring(gL .T, -1));
lua_pop(gL.T, 1); lua_pop(gL.T, 1);
return -1; return -1;
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM <= 503
case LUA_ERRGCMM: case LUA_ERRGCMM:
memprintf(err, "Lua garbage collector error: %s\n", lua_tostring( gL.T, -1)); memprintf(err, "Lua garbage collector error: %s\n", lua_tostring( gL.T, -1));
lua_pop(gL.T, 1); lua_pop(gL.T, 1);
return -1; return -1;
#endif
default: default:
memprintf(err, "Lua unknown error: %s\n", lua_tostring(gL.T, -1)) ; memprintf(err, "Lua unknown error: %s\n", lua_tostring(gL.T, -1)) ;
lua_pop(gL.T, 1); lua_pop(gL.T, 1);
return -1; return -1;
} }
return 0; return 0;
} }
/* Prepend the given <path> followed by a semicolon to the `package.<type>` vari able /* Prepend the given <path> followed by a semicolon to the `package.<type>` vari able
 End of changes. 7 change blocks. 
6 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)