55module soulfind.server.select ;
66@safe :
77
8+ import std.array : Appender;
89import std.datetime : Duration;
910import std.socket : socket_t;
1011
@@ -288,7 +289,7 @@ final class PollSelector : Selector
288289 import core.sys.posix.poll ;
289290 }
290291
291- private pollfd[] pollfds;
292+ private Appender ! ( pollfd[]) pollfds;
292293
293294 this (Duration timeout)
294295 {
@@ -304,7 +305,7 @@ final class PollSelector : Selector
304305 const pfd = create_pollfd(fd, events);
305306
306307 if (is_registered)
307- pollfds[find_fd_idx(fd)] = pfd;
308+ pollfds[][ find_fd_idx(fd)] = pfd;
308309 else
309310 pollfds ~= pfd;
310311
@@ -322,11 +323,11 @@ final class PollSelector : Selector
322323
323324 if (remaining_events == 0 ) {
324325 fd_events.remove(fd);
325- pollfds[idx] = pollfds[$ - 1 ];
326- pollfds.length-- ;
326+ pollfds[][ idx] = pollfds[] [$ - 1 ];
327+ pollfds[] .length-- ;
327328 return ;
328329 }
329- pollfds[idx] = create_pollfd(fd, remaining_events);
330+ pollfds[][ idx] = create_pollfd(fd, remaining_events);
330331 }
331332
332333 override ReadyFD[] select ()
@@ -379,7 +380,7 @@ final class PollSelector : Selector
379380 private int wait ()
380381 {
381382 return poll (
382- pollfds.ptr, cast (uint ) pollfds.length,
383+ pollfds[] .ptr, cast (uint ) pollfds.length,
383384 cast (int ) timeout.total! " msecs"
384385 );
385386 }
0 commit comments