diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-30 15:54:41 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-30 15:54:41 +0000 |
commit | c5f5cb3fd5bb2d77f237c714d4df312bfbbee77c (patch) | |
tree | 403e2ab1088c9e0c8358f493915c4fd3473489ce /src | |
parent | 887a1a5432b24b2973a7f8f60b02192db2bcff76 (diff) | |
download | rspamd-c5f5cb3fd5bb2d77f237c714d4df312bfbbee77c.tar.gz rspamd-c5f5cb3fd5bb2d77f237c714d4df312bfbbee77c.zip |
[Minor] Try to fix race condition in http connection
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_http.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 806322449..2ca01d8a5 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -420,12 +420,6 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) cbd->auth); } - rspamd_http_connection_write_message (cbd->conn, cbd->msg, - cbd->host, cbd->mime_type, cbd, fd, - &cbd->tv, cbd->ev_base); - /* Message is now owned by a connection object */ - cbd->msg = NULL; - if (cbd->session) { rspamd_session_add_event (cbd->session, (event_finalizer_t) lua_http_fin, cbd, @@ -437,6 +431,15 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) rspamd_symcache_item_async_inc (cbd->task, cbd->item, M); } + struct rspamd_http_message *msg = cbd->msg; + + /* Message is now owned by a connection object */ + cbd->msg = NULL; + + rspamd_http_connection_write_message (cbd->conn, msg, + cbd->host, cbd->mime_type, cbd, fd, + &cbd->tv, cbd->ev_base); + return TRUE; } |