diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-21 20:05:24 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-21 20:05:24 +0400 |
commit | cab3370bf1ba1ba765327cc69b86740213e8798a (patch) | |
tree | b520a4095e169cf28aab21b3a8a9ecf10db68220 | |
parent | 13d35d6e24df40bd6764b0bb9a9bc1f554508fab (diff) | |
download | rspamd-cab3370bf1ba1ba765327cc69b86740213e8798a.tar.gz rspamd-cab3370bf1ba1ba765327cc69b86740213e8798a.zip |
Some fixes to dispatcher code to allow change policy more flexible.
-rw-r--r-- | src/buffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index 764f82e39..3fbcb7500 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -549,6 +549,7 @@ dispatcher_cb (gint fd, short what, void *arg) } else { if (g_queue_get_length (d->out_buffers) == 0) { + /* Want read again */ event_del (d->ev); event_set (d->ev, fd, EV_READ | EV_PERSIST, dispatcher_cb, (void *)d); event_base_set (d->ev_base, d->ev); @@ -628,7 +629,7 @@ rspamd_set_dispatcher_policy (rspamd_io_dispatcher_t * d, enum io_policy policy, f_str_t *tmp; gint t; - if (d->policy != policy) { + if (d->policy != policy || nchars != d->nchars) { d->policy = policy; d->nchars = nchars ? nchars : BUFSIZ; /* Resize input buffer if needed */ @@ -693,6 +694,11 @@ rspamd_dispatcher_write (rspamd_io_dispatcher_t * d, void *data, size_t len, gbo debug_ip("plan write event"); return write_buffers (d->fd, d, FALSE); } + /* Otherwise plan write event */ + event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, (void *)d); + event_base_set (d->ev_base, d->ev); + event_add (d->ev, d->tv); + return TRUE; } |