diff options
author | bptato <nincsnevem662@gmail.com> | 2024-09-26 23:59:57 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-09-27 00:01:38 +0200 |
commit | 9b5e0ee59220e490d40aac6d53ad1ec5714a6ff1 (patch) | |
tree | a210f0c01feb2528996f7ee9fc51b0e516764c4e /src/io/poll.nim | |
parent | 7e42176f4f5e73ceaedadac0e326604d90ae443b (diff) | |
download | chawan-9b5e0ee59220e490d40aac6d53ad1ec5714a6ff1.tar.gz |
poll: unset unused fds in register
Diffstat (limited to 'src/io/poll.nim')
-rw-r--r-- | src/io/poll.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io/poll.nim b/src/io/poll.nim index f394233e..fe7aee56 100644 --- a/src/io/poll.nim +++ b/src/io/poll.nim @@ -14,7 +14,10 @@ iterator events*(ctx: PollData): TPollFd = proc register*(ctx: var PollData; fd: int; events: cshort) = if fd >= ctx.fds.len: + let olen = ctx.fds.len ctx.fds.setLen(fd + 1) + for i in olen ..< fd: + ctx.fds[i].fd = -1 ctx.fds[fd].fd = cint(fd) ctx.fds[fd].events = events |