Skip to content

Commit 311ce8e

Browse files
committed
select.d: revert Appender usage
It doesn't work properly.
1 parent 074d268 commit 311ce8e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/server/select.d

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
module soulfind.server.select;
66
@safe:
77

8-
import std.array : Appender;
98
import std.datetime : Duration;
109
import std.socket : socket_t;
1110

@@ -289,7 +288,7 @@ final class PollSelector : Selector
289288
import core.sys.posix.poll;
290289
}
291290

292-
private Appender!(pollfd[]) pollfds;
291+
private pollfd[] pollfds;
293292

294293
this(Duration timeout)
295294
{
@@ -305,7 +304,7 @@ final class PollSelector : Selector
305304
const pfd = create_pollfd(fd, events);
306305

307306
if (is_registered)
308-
pollfds[][find_fd_idx(fd)] = pfd;
307+
pollfds[find_fd_idx(fd)] = pfd;
309308
else
310309
pollfds ~= pfd;
311310

@@ -323,11 +322,11 @@ final class PollSelector : Selector
323322

324323
if (remaining_events == 0) {
325324
fd_events.remove(fd);
326-
pollfds[][idx] = pollfds[][$ - 1];
327-
pollfds[].length--;
325+
pollfds[idx] = pollfds[$ - 1];
326+
pollfds.length--;
328327
return;
329328
}
330-
pollfds[][idx] = create_pollfd(fd, remaining_events);
329+
pollfds[idx] = create_pollfd(fd, remaining_events);
331330
}
332331

333332
override ReadyFD[] select()
@@ -380,7 +379,7 @@ final class PollSelector : Selector
380379
private int wait()
381380
{
382381
return poll(
383-
pollfds[].ptr, cast(uint) pollfds.length,
382+
pollfds.ptr, cast(uint) pollfds.length,
384383
cast(int) timeout.total!"msecs"
385384
);
386385
}

0 commit comments

Comments
 (0)