]> source.dussan.org Git - rspamd.git/commitdiff
* Very hard to detect problem with race among error in socket and destroying task...
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 9 Jul 2010 16:55:46 +0000 (20:55 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 9 Jul 2010 16:55:46 +0000 (20:55 +0400)
src/protocol.c
src/worker.c

index 76627e15e28f4a12d6ffc986dc8b8d6297174e56..999de65ab1cfac5acc1e8b203a5a2841fff5f1b6 100644 (file)
@@ -688,11 +688,13 @@ show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data
        else {
                if (! rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE)) {
                        cd->alive = FALSE;
+                       return;
                }
 
                if (task->cmd == CMD_SYMBOLS && metric_value != NULL) {
                        if (! show_metric_symbols (metric_res, cd)) {
                                cd->alive = FALSE;
+                               return;
                        }
                }
        }
index 11bb24867ba3fa445d3b709f1c7b89175c3cfc24..10a7aeaceef3cd3b5df3c1b1d6f5e573fbba8539 100644 (file)
@@ -370,6 +370,7 @@ write_socket (void *arg)
        switch (task->state) {
        case WRITE_REPLY:
                if (! write_reply (task)) {
+                       destroy_session (task->s);
                        return FALSE;
                }
                if (ctx->is_custom) {
@@ -423,7 +424,9 @@ err_socket (GError * err, void *arg)
        if (ctx->is_custom) {
                fin_custom_filters (task);
        }
-       destroy_session (task->s);
+       if (task->state != WRITE_REPLY) {
+               destroy_session (task->s);
+       }
 }
 
 struct worker_task             *