From: Vsevolod Stakhov Date: Wed, 15 Oct 2014 13:35:20 +0000 (+0100) Subject: Fix HTTP connection termination. X-Git-Tag: 0.7.2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9959f9031e305e117c6b89671ac86c4e84135340;p=thirdparty%2Frspamd.git Fix HTTP connection termination. If a remote side terminates a connection, then notify and destroy client as well. --- diff --git a/src/libutil/http.c b/src/libutil/http.c index e78a798907..db48bd6de5 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -650,8 +650,8 @@ rspamd_http_write_helper (struct rspamd_http_connection *conn) call_finish_handler: if ((conn->opts & RSPAMD_HTTP_CLIENT_SIMPLE) == 0) { rspamd_http_connection_ref (conn); - conn->finish_handler (conn, priv->msg); conn->finished = TRUE; + conn->finish_handler (conn, priv->msg); rspamd_http_connection_unref (conn); } else { @@ -695,6 +695,8 @@ rspamd_http_event_handler (int fd, short what, gpointer ud) if (conn->finished) { REF_RELEASE (pbuf); rspamd_http_connection_unref (conn); + /* Double unref to avoid dangling connections */ + rspamd_http_connection_unref (conn); return; } else {