diff options
Diffstat (limited to 'src')
-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"); |