]> source.dussan.org Git - rspamd.git/commitdiff
Fix HTTP connection termination.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Oct 2014 13:35:20 +0000 (14:35 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Oct 2014 13:35:20 +0000 (14:35 +0100)
If a remote side terminates a connection, then notify and destroy
client as well.

src/libutil/http.c

index e78a798907bffa049de27003c3e2849d5bcc4d65..db48bd6de5a90b2fffeb05c9e5fb9f230196ac02 100644 (file)
@@ -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 {