diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-09-24 13:03:11 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-09-24 13:03:11 +0100 |
commit | d9b7d2be2d84b27faf113f180162988faa319e86 (patch) | |
tree | 539892b4dbd639bec17f4b17d1a75dadbb62b0b3 /src/lua | |
parent | bc6ec09a56659b35317ac4413a43e3bf47bc0e28 (diff) | |
download | rspamd-d9b7d2be2d84b27faf113f180162988faa319e86.tar.gz rspamd-d9b7d2be2d84b27faf113f180162988faa319e86.zip |
[Fix] Lua_tcp: Another try to fix closing logic
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_tcp.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 78085ecc6..952ea06ba 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -2096,7 +2096,30 @@ lua_tcp_close (lua_State *L) } cbd->flags |= LUA_TCP_FLAG_FINISHED; - TCP_RELEASE (cbd); + + if (cbd->ssl_conn) { + /* TODO: postpone close in case ssl is used ! */ + rspamd_ssl_connection_free (cbd->ssl_conn); + cbd->ssl_conn = NULL; + } + + if (cbd->fd != -1) { + rspamd_ev_watcher_stop (cbd->event_loop, &cbd->ev); + close (cbd->fd); + cbd->fd = -1; + } + + if (cbd->addr) { + rspamd_inet_address_free (cbd->addr); + cbd->addr = NULL; + } + + if (cbd->up) { + rspamd_upstream_unref(cbd->up); + cbd->up = NULL; + } + /* Do not release refcount as it will be handled elsewhere */ + /* TCP_RELEASE (cbd); */ return 0; } |