* libs/httpd: Optimized performance again
authorSteven Barth <steven@midlink.org>
Wed, 25 Jun 2008 18:44:25 +0000 (18:44 +0000)
committerSteven Barth <steven@midlink.org>
Wed, 25 Jun 2008 18:44:25 +0000 (18:44 +0000)
libs/httpd/luasrc/httpd.lua

index f471e6b0cc63bf6501d93b0d98f657eaa7fbce1d..9f2dbcde12828ba68bc2908db2e12d406925e3f5 100644 (file)
@@ -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, ...)