aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-27 13:19:03 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-27 13:19:03 +0000
commit65ae7ecb508095bbbcc2a3be464c4bc4fed3a9aa (patch)
treeff0673bebc5019ef8e74422aeefd2794b9e026de /src/worker.c
parent5f45749d11981db96788bc496804eb29d61756fc (diff)
downloadrspamd-65ae7ecb508095bbbcc2a3be464c4bc4fed3a9aa.tar.gz
rspamd-65ae7ecb508095bbbcc2a3be464c4bc4fed3a9aa.zip
[Minor] Implement workaround for legacy clients
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/worker.c b/src/worker.c
index 45ac2200e..bd54368a6 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -146,8 +146,17 @@ rspamd_worker_guard_handler (gint fd, short what, void *data)
* reliable way to distinguish between shutdown(SHUT_WR) and
* close.
*/
- msg_err_task ("the peer has closed connection unexpectedly");
- rspamd_session_destroy (task->s);
+ if (task->cfg->enable_shutdown_workaround) {
+ msg_info_task ("workaround for shutdown enabled, please update "
+ "your client, this support might be removed in future");
+ shutdown (fd, SHUT_RD);
+ event_del (task->guard_ev);
+ task->guard_ev = NULL;
+ }
+ else {
+ msg_err_task ("the peer has closed connection unexpectedly");
+ rspamd_session_destroy (task->s);
+ }
}
else if (errno != EAGAIN) {
msg_err_task ("the peer has closed connection unexpectedly: %s",
@@ -203,8 +212,7 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn,
rspamd_worker_guard_handler, task);
event_base_set (task->ev_base, guard_ev);
event_add (guard_ev, NULL);
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t)event_del, guard_ev);
+ task->guard_ev = guard_ev;
rspamd_task_process (task, RSPAMD_TASK_PROCESS_ALL);