diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-09-18 17:50:40 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-09-18 17:50:40 +0100 |
commit | 319e6580b67bdc8eb7fc4920c49f6e0ae4bad6c4 (patch) | |
tree | ced9afcc9a5e450af2bf984e311da7ff4d57686d /src/worker.c | |
parent | 40e2310e6546325b79f38ef41f258284fe5c1b01 (diff) | |
download | rspamd-319e6580b67bdc8eb7fc4920c49f6e0ae4bad6c4.tar.gz rspamd-319e6580b67bdc8eb7fc4920c49f6e0ae4bad6c4.zip |
Fix writing reply to a client.
Issue: #94
Reported by: @jpastuszek
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/worker.c b/src/worker.c index c0e8cacd2..26e59ace2 100644 --- a/src/worker.c +++ b/src/worker.c @@ -141,7 +141,7 @@ rspamd_worker_error_handler (struct rspamd_http_connection *conn, GError *err) msg_info ("abnormally closing connection from: %s, error: %s", rspamd_inet_address_to_string (&task->client_addr), err->message); - if (task->state != CLOSING_CONNECTION) { + if (task->state != CLOSING_CONNECTION && task->state != WRITING_REPLY) { /* We still need to write a reply */ task->error_code = err->code; task->last_error = @@ -166,7 +166,7 @@ rspamd_worker_finish_handler (struct rspamd_http_connection *conn, rspamd_inet_address_to_string (&task->client_addr)); destroy_session (task->s); } - else { + else if (task->state != WRITING_REPLY) { /* * If all filters have finished their tasks, this function will trigger * writing a reply. @@ -174,6 +174,12 @@ rspamd_worker_finish_handler (struct rspamd_http_connection *conn, task->s->wanna_die = TRUE; check_session_pending (task->s); } + else { + /* + * We are going to write a reply to a client + */ + task->state = CLOSING_CONNECTION; + } return 0; } |