aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-02 03:58:37 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-02 03:58:37 +0300
commit496249dabef15cb033c0a5a2a74f5a021f6012c1 (patch)
treeb236dde072fa60b05f22fd891acdef72fd71ba2f /src/buffer.c
parent629f5f7427f2e03a3e1bfb5340d36f5775b62476 (diff)
downloadrspamd-496249dabef15cb033c0a5a2a74f5a021f6012c1.tar.gz
rspamd-496249dabef15cb033c0a5a2a74f5a021f6012c1.zip
* Fix character policy in dispatcher
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 268b6cbb1..6cffbea9e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -286,8 +286,14 @@ rspamd_create_dispatcher (int fd, enum io_policy policy,
bzero (new, sizeof (rspamd_io_dispatcher_t));
new->pool = memory_pool_new (memory_pool_get_size ());
- new->tv = memory_pool_alloc (new->pool, sizeof (struct timeval));
- memcpy (new->tv, tv, sizeof (struct timeval));
+ if (tv != NULL) {
+ new->tv = memory_pool_alloc (new->pool, sizeof (struct timeval));
+ memcpy (new->tv, tv, sizeof (struct timeval));
+ }
+ else {
+ new->tv = NULL;
+ }
+ new->nchars = 0;
new->policy = policy;
new->read_callback = read_cb;
new->write_callback = write_cb;
@@ -320,7 +326,7 @@ rspamd_set_dispatcher_policy (rspamd_io_dispatcher_t *d,
{
f_str_t *tmp;
- if (d->policy != policy || d->nchars != nchars) {
+ if (d->policy != policy) {
d->policy = policy;
d->nchars = nchars ? nchars : BUFSIZ;
/* Resize input buffer if needed */