diff options
author | Steven Barth <steven@midlink.org> | 2008-06-25 18:44:25 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-25 18:44:25 +0000 |
commit | 231cd0b89d14a49a4b5de477046be01a9d365fb4 (patch) | |
tree | fe08770b2b4503d0df54846701cdf814f8d9dc27 | |
parent | 7d0b17c7d3b344a1cdb1e12e281057036e433a2e (diff) |
* libs/httpd: Optimized performance again
-rw-r--r-- | libs/httpd/luasrc/httpd.lua | 15 |
1 files changed, 9 insertions, 6 deletions
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, ...) |