]> source.dussan.org Git - rspamd.git/commitdiff
Fix dispatcher restoration (fix for controller's logic)
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 1 Aug 2011 13:48:04 +0000 (17:48 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 1 Aug 2011 13:48:04 +0000 (17:48 +0400)
src/buffer.c

index bf357d9493d82ee80a925e8d713874a9bee7f9f7..666869d51382421c8c0614368d46d6b4f6d12abd 100644 (file)
@@ -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