Use relative timestamp for angel call timeouts, increase angel-listen timeout.

* While lighty runs the initialization, the difference between ev_now()
   and ev_time() might be bigger than the timeout - which leads to an
   immediate timeout.
personal/stbuehler/wip
Stefan Bühler 14 years ago
parent d949d65110
commit 1ac09ac2d1

@ -56,6 +56,7 @@ struct liAngelCall {
gint32 id; /* id is -1 if there is no call pending (the callback may still be running) */
liAngelConnection *acon;
ev_timer timeout_watcher;
ev_tstamp timeout;
};
/* error handling */

@ -492,7 +492,8 @@ liAngelCall *li_angel_call_new(liAngelCallCB callback, ev_tstamp timeout) {
g_assert(NULL != callback);
call->callback = callback;
ev_timer_init(&call->timeout_watcher, angel_call_timeout_cb, timeout, 0);
call->timeout = timeout;
ev_init(&call->timeout_watcher, angel_call_timeout_cb);
call->timeout_watcher.data = call;
call->id = -1;
@ -632,6 +633,7 @@ gboolean li_angel_send_call(
if (!prepare_call_header(&buf, ANGEL_CALL_SEND_CALL, call->id, mod, mod_len, action, action_len, 0, data ? data->len : 0, 0, err)) goto error;
ev_timer_set(&call->timeout_watcher, call->timeout + ev_now(acon->loop) - ev_time(), 0);
ev_timer_start(acon->loop, &call->timeout_watcher);
g_mutex_lock(acon->mutex);

@ -86,7 +86,7 @@ static void li_angel_listen_cb(liAngelCall *acall, gpointer pctx, gboolean timeo
/* listen to a socket */
void li_angel_listen(liServer *srv, GString *str, liAngelListenCB cb, gpointer data) {
if (srv->acon) {
liAngelCall *acall = li_angel_call_new(li_angel_listen_cb, 3.0);
liAngelCall *acall = li_angel_call_new(li_angel_listen_cb, 10.0);
angel_listen_cb_ctx *ctx = g_slice_new0(angel_listen_cb_ctx);
GError *err = NULL;

Loading…
Cancel
Save