X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fhttpd%2Fluasrc%2Fhttpd%2Fhandler%2Fluci.lua;fp=libs%2Fhttpd%2Fluasrc%2Fhttpd%2Fhandler%2Fluci.lua;h=c3720ff8711f19edab3bf691c504b34cd01908ce;hp=737abd479e3a8e382d6f5273f858a8e79463a953;hb=95f9bb97ba1d247819e66bced6988ec39301d2e5;hpb=048fe5ce12c63c910cc92b568ec2fdca90c63d62 diff --git a/libs/httpd/luasrc/httpd/handler/luci.lua b/libs/httpd/luasrc/httpd/handler/luci.lua index 737abd479..c3720ff87 100644 --- a/libs/httpd/luasrc/httpd/handler/luci.lua +++ b/libs/httpd/luasrc/httpd/handler/luci.lua @@ -41,7 +41,15 @@ end function Luci.handle_get(self, request, sourcein, sinkerr) if self.limit and #self.running >= self.limit then - return self:failure(503, "Overload") + for k, v in ipairs(self.running) do + if coroutine.status(v) == "dead" then + collectgarbage() + break + end + end + if #self.running >= self.limit then + return self:failure(503, "Overload") + end end table.insert(self.running, coroutine.running()) @@ -84,6 +92,10 @@ function Luci.handle_get(self, request, sourcein, sinkerr) return true elseif id == 5 then active = false + + while (coroutine.resume(x)) do + end + return nil elseif id == 4 then return data