From: Steven Barth Date: Wed, 2 Jul 2008 15:41:47 +0000 (+0000) Subject: * libs/httpd: Fixed garbage collection X-Git-Tag: 0.8.0~717 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f0a0e503783d6571c1a0a90bf14e7531b2f2a176;p=oweals%2Fluci.git * libs/httpd: Fixed garbage collection --- diff --git a/libs/httpd/luasrc/httpd.lua b/libs/httpd/luasrc/httpd.lua index dbbe4c606..541063cc7 100644 --- a/libs/httpd/luasrc/httpd.lua +++ b/libs/httpd/luasrc/httpd.lua @@ -31,7 +31,6 @@ local threadm = {} local threadi = {} local _meta = {__mode = "k"} -setmetatable(threads, _meta) setmetatable(threadm, _meta) setmetatable(threadi, _meta) @@ -110,6 +109,7 @@ function step() local now = os.time() if coroutine.status(thread) == "dead" then threadc = threadc - 1 + threads[client] = nil elseif threadm[client] and threadm[client] + THREAD_TIMEOUT < now then threads[client] = nil threadc = threadc - 1 @@ -121,6 +121,7 @@ function step() end if idle then + collectgarbage() socket.sleep(THREAD_IDLEWAIT) end end