mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-25 20:10:29 +00:00
OnHttpRequest: simplify early exit condition
This commit is contained in:
parent
195961caca
commit
2309b74448
1 changed files with 3 additions and 2 deletions
|
@ -11,11 +11,12 @@ function OnHttpRequest()
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
|
|
||||||
local fd = GetClientFd()
|
local fd = GetClientFd()
|
||||||
local fds = {[fd] = unix.POLLIN | unix.POLLHUP | unix.POLLRDHUP}
|
local client_exit = unix.POLLHUP | unix.POLLRDHUP | unix.POLLERR
|
||||||
|
local fds = {[fd] = unix.POLLIN | client_exit}
|
||||||
-- simple echo server
|
-- simple echo server
|
||||||
while true do
|
while true do
|
||||||
res = unix.poll(fds)
|
res = unix.poll(fds)
|
||||||
if (res[fd] & unix.POLLHUP == unix.POLLHUP) or (res[fd] & unix.POLLRDHUP == unix.POLLRDHUP) then
|
if res[fd] & client_exit > 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local s, t = ws.Read()
|
local s, t = ws.Read()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue