fix poll() to not mutate its parameter

module-based-network
Daniel Barlow 2023-02-15 19:49:16 +00:00
parent d729709869
commit b84a6e0aa5
1 changed files with 5 additions and 3 deletions

View File

@ -84,12 +84,14 @@ local poll = (function()
if timedout then return nil end
local ready = {}
for _, fd in ipairs(readable) do
fds[fd].readable = true
ready[fd] = ready[fd] or { fd = fd }
ready[fd].readable = true
end
for _, fd in ipairs(writeable) do
fds[fd].writeable = true
ready[fd] = ready[fd] or { fd = fd }
ready[fd].writeable = true
end
return fds
return ready
end
end)()