fix poll() to not mutate its parameter

This commit is contained in:
Daniel Barlow 2023-02-15 19:49:16 +00:00
parent d729709869
commit b84a6e0aa5

View file

@ -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)()