commit 5209f85: [Fix] Another try to fix close method in lua_tcp
Vsevolod Stakhov
vsevolod at rspamd.com
Thu Oct 13 22:21:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-10-13 23:15:15 +0100
URL: https://github.com/rspamd/rspamd/commit/5209f8541be49ddc3ca736cb336a5117bb32a971 (HEAD -> master)
[Fix] Another try to fix close method in lua_tcp
---
src/lua/lua_tcp.c | 6 ++++++
1 file changed, 6 insertions(+)
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");
More information about the Commits
mailing list