summaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-27 20:06:15 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-27 20:06:15 +0300
commit080af17704e6aee865b416862575308352d6dcee (patch)
treedf4ed794c67ded095007d9553ed86305a3d212ea /src/worker.c
parent749503560ef72d7b20f935487a77ee4fbc8a9e3f (diff)
downloadrspamd-080af17704e6aee865b416862575308352d6dcee.tar.gz
rspamd-080af17704e6aee865b416862575308352d6dcee.zip
* Fix url-extracter
* Fix soft-shutdown of dispacther * Turn debug on by default in cmake * Change logic of save points
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/worker.c b/src/worker.c
index 09dccb7ff..143cb54de 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -94,7 +94,7 @@ rcpt_destruct (void *pointer)
* Free all structures of worker_task
*/
static void
-free_task (struct worker_task *task)
+free_task (struct worker_task *task, gboolean is_soft)
{
GList *part;
struct mime_part *p;
@@ -111,8 +111,13 @@ free_task (struct worker_task *task)
g_list_free_1 (part);
}
memory_pool_delete (task->task_pool);
- /* Plan dispatcher shutdown */
- task->dispatcher->wanna_die = 1;
+ if (is_soft) {
+ /* Plan dispatcher shutdown */
+ task->dispatcher->wanna_die = 1;
+ }
+ else {
+ rspamd_remove_dispatcher (task->dispatcher);
+ }
close (task->sock);
g_free (task);
}
@@ -178,11 +183,11 @@ write_socket (void *arg)
break;
case CLOSING_CONNECTION:
msg_debug ("write_socket: normally closing connection");
- free_task (task);
+ free_task (task, TRUE);
break;
default:
msg_info ("write_socket: abnormally closing connection");
- free_task (task);
+ free_task (task, TRUE);
break;
}
}
@@ -196,7 +201,7 @@ err_socket (GError *err, void *arg)
struct worker_task *task = (struct worker_task *)arg;
msg_info ("err_socket: abnormally closing connection, error: %s", err->message);
/* Free buffers */
- free_task (task);
+ free_task (task, FALSE);
}
/*
@@ -231,6 +236,7 @@ accept_socket (int fd, short what, void *arg)
msg_err ("accept_socket: cannot allocate memory for task, %m");
return;
}
+ msg_debug ("accept_socket: new task allocated: %p", new_task);
bzero (new_task, sizeof (struct worker_task));
new_task->worker = worker;
new_task->state = READ_COMMAND;