{
g_assert(ev->cb != NULL);
- ev_io_start(EV_A, &ev->io);
+ if (ev->io.fd >= 0) {
+ ev_io_start(EV_A, &ev->io);
+ }
if (timeout > 0) {
/* Update timestamp to avoid timers running early */
{
g_assert(ev->cb != NULL);
- if (ev_can_stop(&ev->io)) {
- ev_io_stop(EV_A, &ev->io);
- ev_io_set(&ev->io, ev->io.fd, what);
- ev_io_start(EV_A, &ev->io);
- }
- else {
- 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->io.fd >= 0) {
+ if (ev_can_stop(&ev->io)) {
+ ev_io_stop(EV_A, &ev->io);
+ ev_io_set(&ev->io, ev->io.fd, what);
+ ev_io_start(EV_A, &ev->io);
+ }
+ else {
+ 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->timeout > 0) {
{
g_assert(ev->cb != NULL);
- if (ev_can_stop(&ev->io)) {
- ev_io_stop(EV_A, &ev->io);
- ev_io_set(&ev->io, ev->io.fd, what);
- ev_io_start(EV_A, &ev->io);
- }
- else {
- 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->io.fd >= 0) {
+ if (ev_can_stop(&ev->io)) {
+ ev_io_stop(EV_A, &ev->io);
+ ev_io_set(&ev->io, ev->io.fd, what);
+ ev_io_start(EV_A, &ev->io);
+ }
+ else {
+ 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 (at > 0) {