* libs/httpd: Fixed garbage collection
This commit is contained in:
parent
b5204f0887
commit
f0a0e50378
1 changed files with 2 additions and 1 deletions
|
@ -31,7 +31,6 @@ local threadm = {}
|
||||||
local threadi = {}
|
local threadi = {}
|
||||||
|
|
||||||
local _meta = {__mode = "k"}
|
local _meta = {__mode = "k"}
|
||||||
setmetatable(threads, _meta)
|
|
||||||
setmetatable(threadm, _meta)
|
setmetatable(threadm, _meta)
|
||||||
setmetatable(threadi, _meta)
|
setmetatable(threadi, _meta)
|
||||||
|
|
||||||
|
@ -110,6 +109,7 @@ function step()
|
||||||
local now = os.time()
|
local now = os.time()
|
||||||
if coroutine.status(thread) == "dead" then
|
if coroutine.status(thread) == "dead" then
|
||||||
threadc = threadc - 1
|
threadc = threadc - 1
|
||||||
|
threads[client] = nil
|
||||||
elseif threadm[client] and threadm[client] + THREAD_TIMEOUT < now then
|
elseif threadm[client] and threadm[client] + THREAD_TIMEOUT < now then
|
||||||
threads[client] = nil
|
threads[client] = nil
|
||||||
threadc = threadc - 1
|
threadc = threadc - 1
|
||||||
|
@ -121,6 +121,7 @@ function step()
|
||||||
end
|
end
|
||||||
|
|
||||||
if idle then
|
if idle then
|
||||||
|
collectgarbage()
|
||||||
socket.sleep(THREAD_IDLEWAIT)
|
socket.sleep(THREAD_IDLEWAIT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue