summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-09-24 13:03:11 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-09-24 13:03:11 +0100
commitd9b7d2be2d84b27faf113f180162988faa319e86 (patch)
tree539892b4dbd639bec17f4b17d1a75dadbb62b0b3 /src/lua
parentbc6ec09a56659b35317ac4413a43e3bf47bc0e28 (diff)
downloadrspamd-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.c25
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;
}