summaryrefslogtreecommitdiffhomepage
path: root/libs/httpd
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-07-02 15:41:47 +0000
committerSteven Barth <steven@midlink.org>2008-07-02 15:41:47 +0000
commitf0a0e503783d6571c1a0a90bf14e7531b2f2a176 (patch)
treefaadac15d88fa51d25e49f7d36920d3bfde9a66e /libs/httpd
parentb5204f0887b60a8a794f2c709f07861bfc9947a6 (diff)
* libs/httpd: Fixed garbage collection
Diffstat (limited to 'libs/httpd')
-rw-r--r--libs/httpd/luasrc/httpd.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/httpd/luasrc/httpd.lua b/libs/httpd/luasrc/httpd.lua
index dbbe4c606d..541063cc7e 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