]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix removing of HTTP event
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 25 Nov 2016 14:49:19 +0000 (14:49 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 25 Nov 2016 14:49:19 +0000 (14:49 +0000)
src/libutil/http.c
src/libutil/map.c

index 7f749b8693be760faabfdad50f423703f73a093a..8796963f10a61fbceff5c17ac958f207e2db4d90 100644 (file)
@@ -1355,7 +1355,11 @@ rspamd_http_connection_reset (struct rspamd_http_connection *conn)
        /* Clear priv */
 
        if (!(priv->flags & RSPAMD_HTTP_CONN_FLAG_RESETED)) {
-               event_del (&priv->ev);
+
+               if (event_get_base (&priv->ev)) {
+                       event_del (&priv->ev);
+               }
+
                rspamd_http_parser_reset (conn);
        }
 
index 07ce616c27db292c992bd50014949c12526c5df6..0ea3ce067a4e9f78572cffac19e81bc2e530e787 100644 (file)
@@ -118,9 +118,9 @@ write_http_request (struct http_callback_data *cbd)
                        g_assert_not_reached ();
                }
 
+               MAP_RETAIN (cbd, "http_callback_data");
                rspamd_http_connection_write_message (cbd->conn, msg, cbd->data->host,
                                NULL, cbd, cbd->fd, &cbd->tv, cbd->ev_base);
-               MAP_RETAIN (cbd, "http_callback_data");
        }
        else {
                msg_err_map ("cannot connect to %s: %s", cbd->data->host,