]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Another try to fix close method in lua_tcp
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 13 Oct 2022 22:15:15 +0000 (23:15 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 13 Oct 2022 22:15:39 +0000 (23:15 +0100)
src/lua/lua_tcp.c

index 643978a49f9f41952939c71afc6a48d2cadfc2a2..82d6af0ee39d49386cde69d469926b94b2a9cb1c 100644 (file)
@@ -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");