"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib-lua/dlua-resume.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

dlua-resume.c  (dovecot-2.3.16):dlua-resume.c  (dovecot-2.3.17)
skipping to change at line 109 skipping to change at line 109
else else
state->status = -1; state->status = -1;
i_assert(state->to == NULL); i_assert(state->to == NULL);
state->to = timeout_add_short(0, call_resume_callback, L); state->to = timeout_add_short(0, call_resume_callback, L);
} }
static void dlua_pcall_yieldable_continue(lua_State *L) static void dlua_pcall_yieldable_continue(lua_State *L)
{ {
struct timeout *to; struct timeout *to;
int nargs; int nargs, nresults;
int ret; int ret;
nargs = dlua_tls_get_int(L, RESUME_NARGS); nargs = dlua_tls_get_int(L, RESUME_NARGS);
to = dlua_tls_get_ptr(L, RESUME_TIMEOUT); to = dlua_tls_get_ptr(L, RESUME_TIMEOUT);
timeout_remove(&to); timeout_remove(&to);
dlua_tls_clear(L, RESUME_TIMEOUT); dlua_tls_clear(L, RESUME_TIMEOUT);
dlua_tls_clear(L, RESUME_NARGS); dlua_tls_clear(L, RESUME_NARGS);
ret = lua_resume(L, L, nargs); ret = lua_resume(L, L, nargs, &nresults);
if (ret == LUA_YIELD) { if (ret == LUA_YIELD) {
/* /*
* thread yielded - nothing to do * thread yielded - nothing to do
* *
* We assume something will call lua_resume(). We don't * We assume something will call lua_resume(). We don't
* care if it is a io related callback or just a timeout. * care if it is a io related callback or just a timeout.
*/ */
} else if (ret == LUA_OK) { } else if (ret == LUA_OK) {
/* thread completed - invoke callback */ /* thread completed - invoke callback */
queue_resume_callback(L, ret); queue_resume_callback(L, ret);
skipping to change at line 160 skipping to change at line 160
* *
* Returns -1 on error or 0 on success. * Returns -1 on error or 0 on success.
*/ */
#undef dlua_pcall_yieldable #undef dlua_pcall_yieldable
int dlua_pcall_yieldable(lua_State *L, const char *func_name, int nargs, int dlua_pcall_yieldable(lua_State *L, const char *func_name, int nargs,
dlua_pcall_yieldable_callback_t *callback, dlua_pcall_yieldable_callback_t *callback,
void *context, const char **error_r) void *context, const char **error_r)
{ {
struct dlua_pcall_resume_state *state; struct dlua_pcall_resume_state *state;
int ret; int ret;
int nresults;
i_assert(lua_status(L) == LUA_OK); i_assert(lua_status(L) == LUA_OK);
lua_getglobal(L, func_name); lua_getglobal(L, func_name);
if (!lua_isfunction(L, -1)) { if (!lua_isfunction(L, -1)) {
/* clean up the stack - function + arguments */ /* clean up the stack - function + arguments */
lua_pop(L, nargs + 1); lua_pop(L, nargs + 1);
*error_r = t_strdup_printf("'%s' is not a function", func_name); *error_r = t_strdup_printf("'%s' is not a function", func_name);
return -1; return -1;
skipping to change at line 183 skipping to change at line 184
state = i_new(struct dlua_pcall_resume_state, 1); state = i_new(struct dlua_pcall_resume_state, 1);
state->callback = callback; state->callback = callback;
state->context = context; state->context = context;
dlua_tls_set_ptr(L, PCALL_RESUME_STATE, state); dlua_tls_set_ptr(L, PCALL_RESUME_STATE, state);
/* stack: args, func (top) */ /* stack: args, func (top) */
lua_insert(L, -(nargs + 1)); lua_insert(L, -(nargs + 1));
/* stack: func, args (top) */ /* stack: func, args (top) */
ret = lua_resume(L, L, nargs); ret = lua_resume(L, L, nargs, &nresults);
if (ret == LUA_YIELD) { if (ret == LUA_YIELD) {
/* /*
* thread yielded - nothing to do * thread yielded - nothing to do
* *
* We assume something will call lua_resume(). We don't * We assume something will call lua_resume(). We don't
* care if it is a io related callback or just a timeout. * care if it is a io related callback or just a timeout.
*/ */
} else { } else {
/* /*
* thread completed / errored * thread completed / errored
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added

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