From: Steven Barth Date: Wed, 25 Jun 2008 18:44:25 +0000 (+0000) Subject: * libs/httpd: Optimized performance again X-Git-Tag: 0.8.0~769 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=231cd0b89d14a49a4b5de477046be01a9d365fb4 * libs/httpd: Optimized performance again --- diff --git a/libs/httpd/luasrc/httpd.lua b/libs/httpd/luasrc/httpd.lua index f471e6b0c..9f2dbcde1 100644 --- a/libs/httpd/luasrc/httpd.lua +++ b/libs/httpd/luasrc/httpd.lua @@ -48,13 +48,16 @@ function Thread.receive(self, ...) local chunk, err, part self.waiting = true - repeat - coroutine.yield() + while true do chunk, err, part = self.socket:receive(...) - until err ~= "timeout" - - self.waiting = false - return chunk, err, part + + if err ~= "timeout" then + self.waiting = false + return chunk, err, part + end + + coroutine.yield() + end end function Thread.resume(self, ...)