ev_io_start (EV_A_ &ev->io);
}
else {
- ev_io_set (&ev->io, ev->io.fd, what);
+ ev->io.data = ev;
+ ev_io_init (&ev->io, rspamd_ev_watcher_io_cb, ev->io.fd, what);
ev_io_start (EV_A_ &ev->io);
}
- if (!(ev_is_active (&ev->tm) || ev_is_pending (&ev->tm))) {
- ev_timer_set (&ev->tm, ev->timeout, 0.0);
- ev_timer_start (EV_A_ &ev->tm);
+ if (ev->timeout > 0) {
+ if (!(ev_is_active (&ev->tm) || ev_is_pending (&ev->tm))) {
+ ev->tm.data = ev;
+ ev_timer_init (&ev->tm, rspamd_ev_watcher_timer_cb, ev->timeout, 0.0);
+ ev_timer_start (EV_A_ &ev->tm);
+ }
}
ev->last_activity = ev_now (EV_A);
}
}
else {
+ rspamd_ev_watcher_init (&cbd->ev, cbd->fd, EV_READ|EV_WRITE,
+ lua_tcp_handler, cbd);
lua_tcp_register_event (cbd);
lua_tcp_plan_handler_event (cbd, TRUE, TRUE);
}
{
/* XXX: it's probably worth to add timeout here - not to wait forever */
while (rspamd_session_events_pending (rspamadm_session) > 0) {
- ev_loop (rspamd_main->event_loop, EVLOOP_ONESHOT);
+ ev_loop (rspamd_main->event_loop, EVRUN_ONCE);
}
}