* libs/httpd: Optimized performance again
This commit is contained in:
parent
7d0b17c7d3
commit
231cd0b89d
1 changed files with 9 additions and 6 deletions
|
@ -48,15 +48,18 @@ function Thread.receive(self, ...)
|
||||||
local chunk, err, part
|
local chunk, err, part
|
||||||
self.waiting = true
|
self.waiting = true
|
||||||
|
|
||||||
repeat
|
while true do
|
||||||
coroutine.yield()
|
|
||||||
chunk, err, part = self.socket:receive(...)
|
chunk, err, part = self.socket:receive(...)
|
||||||
until err ~= "timeout"
|
|
||||||
|
|
||||||
|
if err ~= "timeout" then
|
||||||
self.waiting = false
|
self.waiting = false
|
||||||
return chunk, err, part
|
return chunk, err, part
|
||||||
end
|
end
|
||||||
|
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Thread.resume(self, ...)
|
function Thread.resume(self, ...)
|
||||||
return coroutine.resume(self.routine, self, ...)
|
return coroutine.resume(self.routine, self, ...)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue