From: Vsevolod Stakhov Date: Mon, 1 Aug 2011 13:48:04 +0000 (+0400) Subject: Fix dispatcher restoration (fix for controller's logic) X-Git-Tag: 0.4.2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31ee07b15a645b31618bcaeab0ebee907a60fb70;p=rspamd.git Fix dispatcher restoration (fix for controller's logic) --- diff --git a/src/buffer.c b/src/buffer.c index bf357d949..666869d51 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -635,16 +635,21 @@ rspamd_dispatcher_sendfile (rspamd_io_dispatcher_t *d, gint fd, size_t len) void rspamd_dispatcher_pause (rspamd_io_dispatcher_t * d) { + debug_ip ("paused dispatcher"); event_del (d->ev); + d->is_restored = FALSE; } void rspamd_dispatcher_restore (rspamd_io_dispatcher_t * d) { - event_del (d->ev); - event_set (d->ev, d->fd, EV_READ | EV_WRITE, dispatcher_cb, d); - event_add (d->ev, d->tv); - d->is_restored = TRUE; + if (!d->is_restored) { + debug_ip ("restored dispatcher"); + event_del (d->ev); + event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, d); + event_add (d->ev, d->tv); + d->is_restored = TRUE; + } } #undef debug_ip