diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-10-13 23:15:15 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-10-13 23:15:39 +0100 |
commit | 5209f8541be49ddc3ca736cb336a5117bb32a971 (patch) | |
tree | bb07f4b144848a4b9bfc6137164ae93463d92972 /src/lua/lua_tcp.c | |
parent | 18c57cd8eedd61ecf51af46e5279ebfa77851330 (diff) | |
download | rspamd-5209f8541be49ddc3ca736cb336a5117bb32a971.tar.gz rspamd-5209f8541be49ddc3ca736cb336a5117bb32a971.zip |
[Fix] Another try to fix close method in lua_tcp
Diffstat (limited to 'src/lua/lua_tcp.c')
-rw-r--r-- | src/lua/lua_tcp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 643978a49..82d6af0ee 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -1165,6 +1165,12 @@ lua_tcp_handler (int fd, short what, gpointer ud) else { g_assert_not_reached (); } + + if ((cbd->flags & (LUA_TCP_FLAG_FINISHED|LUA_TCP_FLAG_CONNECTED)) == + (LUA_TCP_FLAG_FINISHED|LUA_TCP_FLAG_CONNECTED)) { + /* A callback has called `close` method, so we need to release a refcount */ + TCP_RELEASE (cbd); + } } else { lua_tcp_push_error (cbd, TRUE, "IO timeout"); |