spawn: call startup notification hooks on time out

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-09 16:03:27 +02:00
parent ff46fd7e0a
commit 3abec42c81
1 changed files with 10 additions and 0 deletions

10
spawn.c
View File

@ -67,6 +67,16 @@ static void
spawn_monitor_timeout(struct ev_loop *loop, ev_timer *w, int revents)
{
spawn_sequence_remove(w->data);
/* send a timeout event to hook function */
if(globalconf.hooks.startup_notification != LUA_REFNIL)
{
lua_createtable(globalconf.L, 0, 2);
lua_pushstring(globalconf.L, sn_startup_sequence_get_id(w->data));
lua_setfield(globalconf.L, -2, "id");
lua_pushliteral(globalconf.L, "timedout");
lua_setfield(globalconf.L, -2, "type");
luaA_dofunction(globalconf.L, globalconf.hooks.startup_notification, 1, 0);
}
sn_startup_sequence_unref(w->data);
p_delete(&w);
}