]> source.dussan.org Git - rspamd.git/commitdiff
* Try to fix output from delayed filters processing
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 12 Jan 2009 15:04:47 +0000 (18:04 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 12 Jan 2009 15:04:47 +0000 (18:04 +0300)
src/filter.c
src/worker.c

index 64d492e6236db1d5da5c48616660e8650a5982e7..290769c54cc6e4fd809fb09af9c92568420ed7a7 100644 (file)
@@ -188,6 +188,9 @@ continue_process_filters (struct worker_task *task)
                                cur = LIST_NEXT (cur, next);
                        }
                        /* All done */
+                       bufferevent_enable (task->bev, EV_WRITE);
+                       evbuffer_drain (task->bev->output, EVBUFFER_LENGTH (task->bev->output));
+                       process_statfiles (task);
                        return 1;
        }
 }
@@ -439,6 +442,8 @@ process_statfiles (struct worker_task *task)
        
        g_hash_table_destroy (cd.tokens);
        g_hash_table_destroy (cd.metrics);
+
+       task->state = WRITE_REPLY;
 }
 
 static void
index d18b260b88cd16172a22ced09bbfcc23ac35daef..bcbea640eac142efeb7575f9e191e90ae0cbda96 100644 (file)
@@ -18,6 +18,7 @@
 #include <perl.h>                 /* from the Perl distribution     */
 
 #include <glib.h>
+#include <event.h>
 #include <gmime/gmime.h>
 
 #include "util.h"
@@ -229,7 +230,7 @@ read_socket (struct bufferevent *bev, void *arg)
                                                task->error_code = RSPAMD_FILTER_ERROR;
                                                task->state = WRITE_ERROR;
                                        }
-                                       else if (r == 1) {
+                                       else if (r == 0) {
                                                task->state = WAIT_FILTER;
                                        }
                                        else {
@@ -239,6 +240,7 @@ read_socket (struct bufferevent *bev, void *arg)
                                if (task->state == WRITE_ERROR || task->state == WRITE_REPLY) {
                                        bufferevent_enable (bev, EV_WRITE);
                                        bufferevent_disable (bev, EV_READ);
+                                       evbuffer_drain (bev->output, EVBUFFER_LENGTH (bev->output));
                                }
                        }
                        else {
@@ -334,7 +336,6 @@ start_worker (struct rspamd_worker *worker, int listen_sock)
        struct sigaction signals;
        int i;
 
-
        worker->srv->pid = getpid ();
        worker->srv->type = TYPE_WORKER;
        event_init ();