fix poll() to not mutate its parameter
This commit is contained in:
parent
d729709869
commit
b84a6e0aa5
1 changed files with 5 additions and 3 deletions
|
@ -84,12 +84,14 @@ local poll = (function()
|
||||||
if timedout then return nil end
|
if timedout then return nil end
|
||||||
local ready = {}
|
local ready = {}
|
||||||
for _, fd in ipairs(readable) do
|
for _, fd in ipairs(readable) do
|
||||||
fds[fd].readable = true
|
ready[fd] = ready[fd] or { fd = fd }
|
||||||
|
ready[fd].readable = true
|
||||||
end
|
end
|
||||||
for _, fd in ipairs(writeable) do
|
for _, fd in ipairs(writeable) do
|
||||||
fds[fd].writeable = true
|
ready[fd] = ready[fd] or { fd = fd }
|
||||||
|
ready[fd].writeable = true
|
||||||
end
|
end
|
||||||
return fds
|
return ready
|
||||||
end
|
end
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue