* 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 f471e6b..9f2dbcd 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, ...)