X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fhttpd%2Fluasrc%2Fhttpd.lua;h=541063cc7e21cf16c6132076d75e76fb868b3615;hp=dbbe4c606de21868f0f79d25c38676281bf0bdc8;hb=f0a0e503783d6571c1a0a90bf14e7531b2f2a176;hpb=b5204f0887b60a8a794f2c709f07861bfc9947a6 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